This commit was manufactured by cvs2svn to create tag 'drow_intercu-
merge-20040921'.

Sprout from gdb_6_3-branch 2004-10-18 08:06:32 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'gdb_6_3-branch'.'
Cherrypick from master 2004-09-21 15:04:41 UTC Daniel Jacobowitz <drow@false.org> '	* dwarf2read.c (struct dwarf2_per_cu_data): New field type_hash.':
    ChangeLog
    Makefile.in
    Makefile.tpl
    bfd/ChangeLog
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/aout-target.h
    bfd/aout-tic30.c
    bfd/bfd-in2.h
    bfd/bfd.c
    bfd/binary.c
    bfd/coff-rs6000.c
    bfd/coff64-rs6000.c
    bfd/coffcode.h
    bfd/config.bfd
    bfd/configure
    bfd/configure.in
    bfd/cpu-i386.c
    bfd/dwarf2.c
    bfd/elf-bfd.h
    bfd/elf-eh-frame.c
    bfd/elf.c
    bfd/elf32-arm.h
    bfd/elf32-cris.c
    bfd/elf32-frv.c
    bfd/elf32-m32r.c
    bfd/elf32-ppc.c
    bfd/elf32-sparc.c
    bfd/elf32-xstormy16.c
    bfd/elf32-xtensa.c
    bfd/elf64-hppa.c
    bfd/elf64-mips.c
    bfd/elf64-x86-64.c
    bfd/elflink.c
    bfd/elfxx-ia64.c
    bfd/elfxx-target.h
    bfd/hash.c
    bfd/i386msdos.c
    bfd/ieee.c
    bfd/ihex.c
    bfd/libaout.h
    bfd/libbfd-in.h
    bfd/libbfd.h
    bfd/libecoff.h
    bfd/mach-o.c
    bfd/mmo.c
    bfd/nlm-target.h
    bfd/oasys.c
    bfd/opncls.c
    bfd/pe-i386.c
    bfd/pef.c
    bfd/pei-i386.c
    bfd/ppcboot.c
    bfd/reloc.c
    bfd/simple.c
    bfd/som.c
    bfd/srec.c
    bfd/syms.c
    bfd/targets.c
    bfd/tekhex.c
    bfd/versados.c
    bfd/version.h
    bfd/vms.c
    bfd/xcoff-target.h
    bfd/xsym.c
    bfd/xtensa-isa.c
    bfd/xtensa-modules.c
    config.guess
    config/ChangeLog
    config/gettext.m4
    configure
    configure.in
    gdb/ChangeLog
    gdb/MAINTAINERS
    gdb/Makefile.in
    gdb/ada-exp.y
    gdb/ada-lang.c
    gdb/ada-lang.h
    gdb/ada-lex.l
    gdb/ada-typeprint.c
    gdb/ada-valprint.c
    gdb/aix-thread.c
    gdb/alphanbsd-tdep.c
    gdb/amd64-nat.h
    gdb/amd64bsd-nat.c
    gdb/amd64fbsd-nat.c
    gdb/amd64nbsd-nat.c
    gdb/amd64obsd-nat.c
    gdb/breakpoint.c
    gdb/bsd-kvm.c
    gdb/config.in
    gdb/config/alpha/alpha-linux.mh
    gdb/config/arm/linux.mh
    gdb/config/djgpp/fnchange.lst
    gdb/config/frv/tm-frv.h
    gdb/config/i386/fbsd.mh
    gdb/config/i386/fbsd64.mh
    gdb/config/i386/linux.mh
    gdb/config/i386/linux64.mh
    gdb/config/i386/nbsd64.mh
    gdb/config/i386/nbsdaout.mh
    gdb/config/i386/nbsdelf.mh
    gdb/config/i386/nm-fbsd.h
    gdb/config/i386/nm-fbsd64.h
    gdb/config/i386/nm-i386.h
    gdb/config/i386/nm-nbsdaout.h
    gdb/config/i386/nm-obsd.h
    gdb/config/i386/obsd.mh
    gdb/config/i386/obsd64.mh
    gdb/config/i386/obsdaout.mh
    gdb/config/ia64/linux.mh
    gdb/config/ia64/nm-linux.h
    gdb/config/m68k/linux.mh
    gdb/config/m88k/obsd.mh
    gdb/config/mips/linux.mh
    gdb/config/pa/linux.mh
    gdb/config/powerpc/linux.mh
    gdb/config/powerpc/nbsd.mh
    gdb/config/powerpc/ppc64-linux.mh
    gdb/config/s390/s390.mh
    gdb/config/sparc/fbsd.mh
    gdb/config/sparc/linux.mh
    gdb/config/sparc/linux64.mh
    gdb/config/sparc/nbsd64.mh
    gdb/config/sparc/nbsdaout.mh
    gdb/config/sparc/nbsdelf.mh
    gdb/config/vax/nbsdaout.mh
    gdb/config/vax/nbsdelf.mh
    gdb/config/vax/obsd.mh
    gdb/configure
    gdb/configure.in
    gdb/configure.tgt
    gdb/corelow.c
    gdb/cris-tdep.c
    gdb/defs.h
    gdb/doc/ChangeLog
    gdb/doc/gdb.texinfo
    gdb/doc/gdbint.texinfo
    gdb/doc/stabs.texinfo
    gdb/dwarf2read.c
    gdb/event-top.c
    gdb/exec.c
    gdb/fbsd-proc.c
    gdb/fork-child.c
    gdb/frv-tdep.c
    gdb/gdb_indent.sh
    gdb/gdb_thread_db.h
    gdb/gdbserver/ChangeLog
    gdb/gdbserver/Makefile.in
    gdb/gdbserver/configure
    gdb/gdbserver/configure.in
    gdb/gdbserver/linux-i386-low.c
    gdb/gdbserver/linux-low.c
    gdb/gdbserver/linux-x86-64-low.c
    gdb/gdbserver/proc-service.c
    gdb/gdbserver/remote-utils.c
    gdb/gdbserver/thread-db.c
    gdb/gdbtypes.h
    gdb/gnu-nat.c
    gdb/go32-nat.c
    gdb/hppa-tdep.c
    gdb/hppah-nat.c
    gdb/hpux-thread.c
    gdb/i386-nat.c
    gdb/i386fbsd-nat.c
    gdb/i386gnu-nat.c
    gdb/ia64-linux-nat.c
    gdb/inf-child.c
    gdb/inf-ptrace.c
    gdb/infcall.c
    gdb/infptrace.c
    gdb/infrun.c
    gdb/inftarg.c
    gdb/infttrace.c
    gdb/language.c
    gdb/lin-lwp.c
    gdb/linux-nat.c
    gdb/linux-proc.c
    gdb/m32r-tdep.c
    gdb/m88kbsd-nat.c
    gdb/mips-tdep.c
    gdb/monitor.c
    gdb/nto-procfs.c
    gdb/objfiles.c
    gdb/ppc-bdm.c
    gdb/procfs.c
    gdb/regcache.c
    gdb/remote-e7000.c
    gdb/remote-m32r-sdi.c
    gdb/remote-mips.c
    gdb/remote-rdi.c
    gdb/remote-rdp.c
    gdb/remote-sds.c
    gdb/remote-sim.c
    gdb/remote-st.c
    gdb/remote-vx.c
    gdb/remote.c
    gdb/rs6000-nat.c
    gdb/rs6000-tdep.c
    gdb/sh-tdep.c
    gdb/sh-tdep.h
    gdb/sol-thread.c
    gdb/solib-sunos.c
    gdb/source.c
    gdb/sparc-linux-tdep.c
    gdb/sparc-nat.c
    gdb/sparc-nat.h
    gdb/sparc64-linux-tdep.c
    gdb/sparc64nbsd-nat.c
    gdb/sparcnbsd-nat.c
    gdb/symfile.c
    gdb/symtab.c
    gdb/target.c
    gdb/target.h
    gdb/testsuite/ChangeLog
    gdb/testsuite/Makefile.in
    gdb/testsuite/config/gdbserver.exp
    gdb/testsuite/configure
    gdb/testsuite/configure.in
    gdb/testsuite/gdb.asm/asm-source.exp
    gdb/testsuite/gdb.base/bigcore.c
    gdb/testsuite/gdb.base/bigcore.exp
    gdb/testsuite/gdb.base/constvars.exp
    gdb/testsuite/gdb.base/overlays.exp
    gdb/testsuite/gdb.base/sigstep.exp
    gdb/testsuite/gdb.base/volatile.exp
    gdb/testsuite/gdb.mi/gdb701.c
    gdb/testsuite/gdb.threads/bp_in_thread.exp
    gdb/testsuite/gdb.threads/pthread_cond_wait.exp
    gdb/testsuite/gdb.threads/watchthreads.exp
    gdb/thread-db.c
    gdb/top.c
    gdb/tui/tui-wingeneral.c
    gdb/utils.c
    gdb/uw-thread.c
    gdb/v850ice.c
    gdb/vaxbsd-nat.c
    gdb/version.in
    gdb/win32-nat.c
    gdb/wince.c
    gdb/xstormy16-tdep.c
    include/ChangeLog
    include/bfdlink.h
    include/elf/ChangeLog
    include/elf/arm.h
    include/elf/common.h
    include/elf/dwarf2.h
    include/elf/x86-64.h
    include/elf/xtensa.h
    include/opcode/ChangeLog
    include/opcode/arm.h
    include/opcode/crx.h
    include/xtensa-config.h
    include/xtensa-isa-internal.h
    include/xtensa-isa.h
    install-sh
    intl/ChangeLog
    intl/Makefile.in
    intl/acconfig.h
    intl/aclocal.m4
    intl/bindtextdom.c
    intl/cat-compat.c
    intl/config.in
    intl/configure
    intl/configure.in
    intl/dcgettext.c
    intl/dgettext.c
    intl/explodename.c
    intl/finddomain.c
    intl/gettext.c
    intl/gettext.h
    intl/gettextP.h
    intl/hash-string.h
    intl/intl-compat.c
    intl/intlh.inst.in
    intl/l10nflist.c
    intl/libgettext.h
    intl/libintl.glibc
    intl/linux-msg.sed
    intl/loadinfo.h
    intl/loadmsgcat.c
    intl/localealias.c
    intl/po2tbl.sed.in
    intl/textdomain.c
    intl/xopen-msg.sed
    ltcf-c.sh
    ltcf-cxx.sh
    ltconfig
    mmalloc/COPYING.LIB
    mmalloc/ChangeLog
    mmalloc/MAINTAINERS
    mmalloc/Makefile.in
    mmalloc/TODO
    mmalloc/acinclude.m4
    mmalloc/aclocal.m4
    mmalloc/attach.c
    mmalloc/configure
    mmalloc/configure.in
    mmalloc/detach.c
    mmalloc/keys.c
    mmalloc/mcalloc.c
    mmalloc/mfree.c
    mmalloc/mm.c
    mmalloc/mmalloc.c
    mmalloc/mmalloc.h
    mmalloc/mmalloc.texi
    mmalloc/mmap-sup.c
    mmalloc/mmcheck.c
    mmalloc/mmemalign.c
    mmalloc/mmprivate.h
    mmalloc/mmstats.c
    mmalloc/mmtrace.awk
    mmalloc/mmtrace.c
    mmalloc/mrealloc.c
    mmalloc/mvalloc.c
    mmalloc/sbrk-sup.c
    opcodes/ChangeLog
    opcodes/Makefile.am
    opcodes/Makefile.in
    opcodes/arm-dis.c
    opcodes/arm-opc.h
    opcodes/crx-dis.c
    opcodes/crx-opc.c
    opcodes/pdp11-dis.c
    opcodes/ppc-opc.c
    opcodes/xtensa-dis.c
    sim/common/ChangeLog
    sim/common/cgen-defs.h
    sim/mips/ChangeLog
    sim/mips/m16.igen
    sim/ppc/ChangeLog
    sim/ppc/config.in
    sim/ppc/configure
    sim/ppc/configure.in
    sim/ppc/emul_netbsd.c
Cherrypick from cygnus 1999-05-03 07:29:11 UTC Richard Henderson <rth@redhat.com> '19990502 sourceware import':
    ylwrap
Delete:
    config/codeset.m4
    config/gcc-lib-path.m4
    config/gettext-sister.m4
    config/glibc21.m4
    config/iconv.m4
    config/intdiv0.m4
    config/inttypes-pri.m4
    config/inttypes.m4
    config/inttypes_h.m4
    config/lcmessage.m4
    config/lib-ld.m4
    config/lib-link.m4
    config/lib-prefix.m4
    config/mh-x86omitfp
    config/nls.m4
    config/po.m4
    config/stdint_h.m4
    config/uintmax_t.m4
    config/ulonglong.m4
    config/warnings.m4
    gdb/config/m32r/linux.mh
    gdb/config/m32r/linux.mt
    gdb/config/m32r/nm-linux.h
    gdb/m32r-linux-nat.c
    gdb/m32r-linux-tdep.c
    gdb/m32r-tdep.h
    gdb/testsuite/gdb.asm/m32r-linux.inc
    gdb/testsuite/gdb.dwarf2/Makefile.in
    gdb/testsuite/gdb.dwarf2/dw2-basic.S
    gdb/testsuite/gdb.dwarf2/dw2-basic.exp
    gdb/testsuite/gdb.dwarf2/dw2-intercu.S
    gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
    gdb/testsuite/gdb.dwarf2/file1.txt
    gdb/testsuite/gdb.dwarf2/main.c
    gdb/testsuite/gdb.threads/watchthreads.c
diff --git a/ChangeLog b/ChangeLog
index dc234e3..1a84637 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,71 +1,3 @@
-2004-10-12  Kelley Cook  <kcook@gcc.gnu.org>
-
-	* configure.in (*-*-cygwin*): Supress warning if newlib not present.
-	* configure: Regenerate.
-
-2004-10-06  Paolo Bonzini  <bonzini@gnu.org>
-
-	Fix wrong conflict resolution in:
-
-	2004-08-16  Paolo Bonzini  <bonzini@gnu.org>
-
-	* Makefile.in: Regenerate.
-	* Makefile.tpl (Autogenerated `all-*' targets): Invoke $(TARGET-*)
-	in the recursive `make', instead of hardwiring `all'.
-	(Autogenerated TARGET-* variables): New.
-
-2004-10-05  Ulrich Weigand  <uweigand@de.ibm.com>
-
-	Merged from GCC / libtool upstream:
-	2004-10-02  P.J. Darcy  <darcypj@us.ibm.com>
-	* ltcf-c.sh (tpf*): Add ld_shlibs=yes.
-	* ltcf-cxx.sh (tpf*): Likewise.
-	* ltconfig (tpf*): Add TPF OS configuration support.
-
-2004-09-30  Tomer Levi  <Tomer.Levi@nsc.com>
-
-	* configure.in: Enable target-libgloss for crx-*-*.
-        * configure: Regenerate.
-
-2004-09-24  Michael Roth  <mroth@nessie.de>
-
-	* configure.in (--without-headers): Add missing double quotes.
-	* configure: Regenerate.
-
-2004-09-24  Kelley Cook <kcook@gcc.gnu.org>
-
-	* ylwrap: Revert to previous version.
-
-2004-09-23  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR bootstrap/17369
-	* Makefile.tpl (REALLY_SET_LIB_PATH): Add @SET_GCC_LIB_PATH@.
-	(HOST_EXPORTS]): Add @SET_GCC_LIB_PATH@. Set and export
-	SET_GCC_LIB_PATH_CMD.
-	(BASE_TARGET_EXPORTS): Likewise.
-	* Makefile.in: Regenerated.
-
-	* configure.in (SET_GCC_LIB_PATH): Set and substitute.
-	* configure: Regenerated.
-
-2004-09-23  Kelley Cook  <kcook@gcc.gnu.org>
-
-	* config.guess: New upstream version
-	* compile, depcomp, install-sh, ylwrap: Likewise.
-
-2004-09-19  Roger Sayle  <roger@eyesopen.com>
-
-	* config/mh-x86omitfp: New host makefile fragment.  Add
-	-fomit-frame-pointer to the default BOOT_CFLAGS.
-	* configure.in: Use it to speed up bootstrap on some IA-32 hosts.
-	* configure: Regenerate.
-
-2004-09-15  Andrew Pinski  <pinskia@physics.uc.edu>
-
-	PR target/11572
-	* configure.in (*-*-darwin*): Renable libobjc.
-	* configure: Regenerate.
-
 2004-09-09  Daniel Berlin  <dberlin@dberlin.org>
 	
 	* Makefile.def: Remove libbanshee.
diff --git a/Makefile.in b/Makefile.in
index 0867ec9..8047c00 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -101,7 +101,6 @@
 # Some platforms don't like blank entries, so we remove duplicate,
 # leading and trailing colons.
 REALLY_SET_LIB_PATH = \
-  @SET_GCC_LIB_PATH@ \
   $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 # This is the list of directories to be built for the build system.
@@ -171,9 +170,7 @@
 	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
-	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	GMPINC="$(HOST_GMPINC)"; export GMPINC;
 
 # Similar, for later GCC stages.
 STAGE_HOST_EXPORTS = \
@@ -207,9 +204,7 @@
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
 	NM="$(NM_FOR_TARGET)"; export NM; \
 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
-	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES;
 
 RAW_CXX_TARGET_EXPORTS = \
 	$(BASE_TARGET_EXPORTS) \
@@ -2543,15 +2538,13 @@
 .PHONY: all-ash maybe-all-ash
 maybe-all-ash:
 @if ash
-TARGET-ash=all
 maybe-all-ash: all-ash
 all-ash: configure-ash
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd ash && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-ash))
+	(cd ash && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif ash
 
 .PHONY: check-ash maybe-check-ash
@@ -2847,15 +2840,13 @@
 .PHONY: all-autoconf maybe-all-autoconf
 maybe-all-autoconf:
 @if autoconf
-TARGET-autoconf=all
 maybe-all-autoconf: all-autoconf
 all-autoconf: configure-autoconf
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd autoconf && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-autoconf))
+	(cd autoconf && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif autoconf
 
 .PHONY: check-autoconf maybe-check-autoconf
@@ -3151,15 +3142,13 @@
 .PHONY: all-automake maybe-all-automake
 maybe-all-automake:
 @if automake
-TARGET-automake=all
 maybe-all-automake: all-automake
 all-automake: configure-automake
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd automake && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-automake))
+	(cd automake && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif automake
 
 .PHONY: check-automake maybe-check-automake
@@ -3455,15 +3444,13 @@
 .PHONY: all-bash maybe-all-bash
 maybe-all-bash:
 @if bash
-TARGET-bash=all
 maybe-all-bash: all-bash
 all-bash: configure-bash
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd bash && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-bash))
+	(cd bash && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif bash
 
 .PHONY: check-bash maybe-check-bash
@@ -3760,7 +3747,6 @@
 .PHONY: all-bfd maybe-all-bfd
 maybe-all-bfd:
 @if bfd
-TARGET-bfd=all
 maybe-all-bfd: all-bfd
 all-bfd: configure-bfd
 	@test -f stage_last && exit 0; \
@@ -3768,8 +3754,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd bfd && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-bfd))
+	(cd bfd && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif bfd
 
 .PHONY: check-bfd maybe-check-bfd
@@ -4066,7 +4051,6 @@
 .PHONY: all-opcodes maybe-all-opcodes
 maybe-all-opcodes:
 @if opcodes
-TARGET-opcodes=all
 maybe-all-opcodes: all-opcodes
 all-opcodes: configure-opcodes
 	@test -f stage_last && exit 0; \
@@ -4074,8 +4058,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd opcodes && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-opcodes))
+	(cd opcodes && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif opcodes
 
 .PHONY: check-opcodes maybe-check-opcodes
@@ -4372,7 +4355,6 @@
 .PHONY: all-binutils maybe-all-binutils
 maybe-all-binutils:
 @if binutils
-TARGET-binutils=all
 maybe-all-binutils: all-binutils
 all-binutils: configure-binutils
 	@test -f stage_last && exit 0; \
@@ -4380,8 +4362,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd binutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-binutils))
+	(cd binutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif binutils
 
 .PHONY: check-binutils maybe-check-binutils
@@ -4677,15 +4658,13 @@
 .PHONY: all-bison maybe-all-bison
 maybe-all-bison:
 @if bison
-TARGET-bison=all
 maybe-all-bison: all-bison
 all-bison: configure-bison
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd bison && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-bison))
+	(cd bison && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif bison
 
 .PHONY: check-bison maybe-check-bison
@@ -4984,15 +4963,13 @@
 .PHONY: all-byacc maybe-all-byacc
 maybe-all-byacc:
 @if byacc
-TARGET-byacc=all
 maybe-all-byacc: all-byacc
 all-byacc: configure-byacc
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd byacc && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-byacc))
+	(cd byacc && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif byacc
 
 .PHONY: check-byacc maybe-check-byacc
@@ -5291,15 +5268,13 @@
 .PHONY: all-bzip2 maybe-all-bzip2
 maybe-all-bzip2:
 @if bzip2
-TARGET-bzip2=all
 maybe-all-bzip2: all-bzip2
 all-bzip2: configure-bzip2
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd bzip2 && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-bzip2))
+	(cd bzip2 && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif bzip2
 
 .PHONY: check-bzip2 maybe-check-bzip2
@@ -5595,15 +5570,13 @@
 .PHONY: all-dejagnu maybe-all-dejagnu
 maybe-all-dejagnu:
 @if dejagnu
-TARGET-dejagnu=all
 maybe-all-dejagnu: all-dejagnu
 all-dejagnu: configure-dejagnu
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd dejagnu && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-dejagnu))
+	(cd dejagnu && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif dejagnu
 
 .PHONY: check-dejagnu maybe-check-dejagnu
@@ -5899,15 +5872,13 @@
 .PHONY: all-diff maybe-all-diff
 maybe-all-diff:
 @if diff
-TARGET-diff=all
 maybe-all-diff: all-diff
 all-diff: configure-diff
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd diff && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-diff))
+	(cd diff && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif diff
 
 .PHONY: check-diff maybe-check-diff
@@ -6203,15 +6174,13 @@
 .PHONY: all-dosutils maybe-all-dosutils
 maybe-all-dosutils:
 @if dosutils
-TARGET-dosutils=all
 maybe-all-dosutils: all-dosutils
 all-dosutils: configure-dosutils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd dosutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-dosutils))
+	(cd dosutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif dosutils
 
 .PHONY: check-dosutils maybe-check-dosutils
@@ -6502,15 +6471,13 @@
 .PHONY: all-etc maybe-all-etc
 maybe-all-etc:
 @if etc
-TARGET-etc=all
 maybe-all-etc: all-etc
 all-etc: configure-etc
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd etc && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-etc))
+	(cd etc && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif etc
 
 .PHONY: check-etc maybe-check-etc
@@ -6806,15 +6773,13 @@
 .PHONY: all-fastjar maybe-all-fastjar
 maybe-all-fastjar:
 @if fastjar
-TARGET-fastjar=all
 maybe-all-fastjar: all-fastjar
 all-fastjar: configure-fastjar
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd fastjar && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-fastjar))
+	(cd fastjar && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif fastjar
 
 .PHONY: check-fastjar maybe-check-fastjar
@@ -7113,15 +7078,13 @@
 .PHONY: all-fileutils maybe-all-fileutils
 maybe-all-fileutils:
 @if fileutils
-TARGET-fileutils=all
 maybe-all-fileutils: all-fileutils
 all-fileutils: configure-fileutils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd fileutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-fileutils))
+	(cd fileutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif fileutils
 
 .PHONY: check-fileutils maybe-check-fileutils
@@ -7417,15 +7380,13 @@
 .PHONY: all-findutils maybe-all-findutils
 maybe-all-findutils:
 @if findutils
-TARGET-findutils=all
 maybe-all-findutils: all-findutils
 all-findutils: configure-findutils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd findutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-findutils))
+	(cd findutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif findutils
 
 .PHONY: check-findutils maybe-check-findutils
@@ -7721,15 +7682,13 @@
 .PHONY: all-find maybe-all-find
 maybe-all-find:
 @if find
-TARGET-find=all
 maybe-all-find: all-find
 all-find: configure-find
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd find && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-find))
+	(cd find && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif find
 
 .PHONY: check-find maybe-check-find
@@ -8025,15 +7984,13 @@
 .PHONY: all-flex maybe-all-flex
 maybe-all-flex:
 @if flex
-TARGET-flex=all
 maybe-all-flex: all-flex
 all-flex: configure-flex
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd flex && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-flex))
+	(cd flex && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif flex
 
 .PHONY: check-flex maybe-check-flex
@@ -8333,7 +8290,6 @@
 .PHONY: all-gas maybe-all-gas
 maybe-all-gas:
 @if gas
-TARGET-gas=all
 maybe-all-gas: all-gas
 all-gas: configure-gas
 	@test -f stage_last && exit 0; \
@@ -8341,8 +8297,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gas && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gas))
+	(cd gas && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gas
 
 .PHONY: check-gas maybe-check-gas
@@ -8639,7 +8594,6 @@
 .PHONY: all-gcc maybe-all-gcc
 maybe-all-gcc:
 @if gcc
-TARGET-gcc=`if [ -f gcc/stage_last ]; then echo quickstrap ; else echo all; fi`
 maybe-all-gcc: all-gcc
 all-gcc: configure-gcc
 	@test -f stage_last && exit 0; \
@@ -8647,8 +8601,8 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gcc && $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
-	  $(TARGET-gcc))
+	(cd gcc && $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)  \
+	    `if [ -f gcc/stage_last ]; then echo quickstrap ; else echo all; fi` )
 @endif gcc
 
 .PHONY: check-gcc maybe-check-gcc
@@ -8944,15 +8898,13 @@
 .PHONY: all-gawk maybe-all-gawk
 maybe-all-gawk:
 @if gawk
-TARGET-gawk=all
 maybe-all-gawk: all-gawk
 all-gawk: configure-gawk
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gawk && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gawk))
+	(cd gawk && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gawk
 
 .PHONY: check-gawk maybe-check-gawk
@@ -9248,15 +9200,13 @@
 .PHONY: all-gettext maybe-all-gettext
 maybe-all-gettext:
 @if gettext
-TARGET-gettext=all
 maybe-all-gettext: all-gettext
 all-gettext: configure-gettext
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gettext && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gettext))
+	(cd gettext && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gettext
 
 .PHONY: check-gettext maybe-check-gettext
@@ -9552,15 +9502,13 @@
 .PHONY: all-gnuserv maybe-all-gnuserv
 maybe-all-gnuserv:
 @if gnuserv
-TARGET-gnuserv=all
 maybe-all-gnuserv: all-gnuserv
 all-gnuserv: configure-gnuserv
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gnuserv && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gnuserv))
+	(cd gnuserv && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gnuserv
 
 .PHONY: check-gnuserv maybe-check-gnuserv
@@ -9856,15 +9804,13 @@
 .PHONY: all-gprof maybe-all-gprof
 maybe-all-gprof:
 @if gprof
-TARGET-gprof=all
 maybe-all-gprof: all-gprof
 all-gprof: configure-gprof
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gprof && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gprof))
+	(cd gprof && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gprof
 
 .PHONY: check-gprof maybe-check-gprof
@@ -10160,15 +10106,13 @@
 .PHONY: all-gzip maybe-all-gzip
 maybe-all-gzip:
 @if gzip
-TARGET-gzip=all
 maybe-all-gzip: all-gzip
 all-gzip: configure-gzip
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gzip && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-gzip))
+	(cd gzip && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif gzip
 
 .PHONY: check-gzip maybe-check-gzip
@@ -10464,15 +10408,13 @@
 .PHONY: all-hello maybe-all-hello
 maybe-all-hello:
 @if hello
-TARGET-hello=all
 maybe-all-hello: all-hello
 all-hello: configure-hello
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd hello && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-hello))
+	(cd hello && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif hello
 
 .PHONY: check-hello maybe-check-hello
@@ -10768,15 +10710,13 @@
 .PHONY: all-indent maybe-all-indent
 maybe-all-indent:
 @if indent
-TARGET-indent=all
 maybe-all-indent: all-indent
 all-indent: configure-indent
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd indent && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-indent))
+	(cd indent && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif indent
 
 .PHONY: check-indent maybe-check-indent
@@ -11073,7 +11013,6 @@
 .PHONY: all-intl maybe-all-intl
 maybe-all-intl:
 @if intl
-TARGET-intl=all
 maybe-all-intl: all-intl
 all-intl: configure-intl
 	@test -f stage_last && exit 0; \
@@ -11081,8 +11020,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd intl && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-intl))
+	(cd intl && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif intl
 
 .PHONY: check-intl maybe-check-intl
@@ -11378,15 +11316,13 @@
 .PHONY: all-tcl maybe-all-tcl
 maybe-all-tcl:
 @if tcl
-TARGET-tcl=all
 maybe-all-tcl: all-tcl
 all-tcl: configure-tcl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd tcl && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-tcl))
+	(cd tcl && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif tcl
 
 .PHONY: check-tcl maybe-check-tcl
@@ -11667,15 +11603,13 @@
 .PHONY: all-itcl maybe-all-itcl
 maybe-all-itcl:
 @if itcl
-TARGET-itcl=all
 maybe-all-itcl: all-itcl
 all-itcl: configure-itcl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd itcl && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-itcl))
+	(cd itcl && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif itcl
 
 .PHONY: check-itcl maybe-check-itcl
@@ -11972,7 +11906,6 @@
 .PHONY: all-ld maybe-all-ld
 maybe-all-ld:
 @if ld
-TARGET-ld=all
 maybe-all-ld: all-ld
 all-ld: configure-ld
 	@test -f stage_last && exit 0; \
@@ -11980,8 +11913,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd ld && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-ld))
+	(cd ld && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif ld
 
 .PHONY: check-ld maybe-check-ld
@@ -12278,7 +12210,6 @@
 .PHONY: all-libcpp maybe-all-libcpp
 maybe-all-libcpp:
 @if libcpp
-TARGET-libcpp=all
 maybe-all-libcpp: all-libcpp
 all-libcpp: configure-libcpp
 	@test -f stage_last && exit 0; \
@@ -12286,8 +12217,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd libcpp && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-libcpp))
+	(cd libcpp && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif libcpp
 
 .PHONY: check-libcpp maybe-check-libcpp
@@ -12583,15 +12513,13 @@
 .PHONY: all-libgui maybe-all-libgui
 maybe-all-libgui:
 @if libgui
-TARGET-libgui=all
 maybe-all-libgui: all-libgui
 all-libgui: configure-libgui
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd libgui && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-libgui))
+	(cd libgui && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif libgui
 
 .PHONY: check-libgui maybe-check-libgui
@@ -12888,7 +12816,6 @@
 .PHONY: all-libiberty maybe-all-libiberty
 maybe-all-libiberty:
 @if libiberty
-TARGET-libiberty=all
 maybe-all-libiberty: all-libiberty
 all-libiberty: configure-libiberty
 	@test -f stage_last && exit 0; \
@@ -12896,8 +12823,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd libiberty && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-libiberty))
+	(cd libiberty && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif libiberty
 
 .PHONY: check-libiberty maybe-check-libiberty
@@ -13193,15 +13119,13 @@
 .PHONY: all-libtool maybe-all-libtool
 maybe-all-libtool:
 @if libtool
-TARGET-libtool=all
 maybe-all-libtool: all-libtool
 all-libtool: configure-libtool
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd libtool && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-libtool))
+	(cd libtool && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif libtool
 
 .PHONY: check-libtool maybe-check-libtool
@@ -13497,15 +13421,13 @@
 .PHONY: all-m4 maybe-all-m4
 maybe-all-m4:
 @if m4
-TARGET-m4=all
 maybe-all-m4: all-m4
 all-m4: configure-m4
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd m4 && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-m4))
+	(cd m4 && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif m4
 
 .PHONY: check-m4 maybe-check-m4
@@ -13801,15 +13723,13 @@
 .PHONY: all-make maybe-all-make
 maybe-all-make:
 @if make
-TARGET-make=all
 maybe-all-make: all-make
 all-make: configure-make
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd make && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-make))
+	(cd make && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif make
 
 .PHONY: check-make maybe-check-make
@@ -14105,15 +14025,13 @@
 .PHONY: all-mmalloc maybe-all-mmalloc
 maybe-all-mmalloc:
 @if mmalloc
-TARGET-mmalloc=all
 maybe-all-mmalloc: all-mmalloc
 all-mmalloc: configure-mmalloc
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd mmalloc && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-mmalloc))
+	(cd mmalloc && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif mmalloc
 
 .PHONY: check-mmalloc maybe-check-mmalloc
@@ -14404,15 +14322,13 @@
 .PHONY: all-patch maybe-all-patch
 maybe-all-patch:
 @if patch
-TARGET-patch=all
 maybe-all-patch: all-patch
 all-patch: configure-patch
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd patch && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-patch))
+	(cd patch && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif patch
 
 .PHONY: check-patch maybe-check-patch
@@ -14708,15 +14624,13 @@
 .PHONY: all-perl maybe-all-perl
 maybe-all-perl:
 @if perl
-TARGET-perl=all
 maybe-all-perl: all-perl
 all-perl: configure-perl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd perl && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-perl))
+	(cd perl && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif perl
 
 .PHONY: check-perl maybe-check-perl
@@ -15012,15 +14926,13 @@
 .PHONY: all-prms maybe-all-prms
 maybe-all-prms:
 @if prms
-TARGET-prms=all
 maybe-all-prms: all-prms
 all-prms: configure-prms
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd prms && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-prms))
+	(cd prms && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif prms
 
 .PHONY: check-prms maybe-check-prms
@@ -15316,15 +15228,13 @@
 .PHONY: all-rcs maybe-all-rcs
 maybe-all-rcs:
 @if rcs
-TARGET-rcs=all
 maybe-all-rcs: all-rcs
 all-rcs: configure-rcs
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd rcs && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-rcs))
+	(cd rcs && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif rcs
 
 .PHONY: check-rcs maybe-check-rcs
@@ -15620,15 +15530,13 @@
 .PHONY: all-readline maybe-all-readline
 maybe-all-readline:
 @if readline
-TARGET-readline=all
 maybe-all-readline: all-readline
 all-readline: configure-readline
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd readline && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-readline))
+	(cd readline && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif readline
 
 .PHONY: check-readline maybe-check-readline
@@ -15924,15 +15832,13 @@
 .PHONY: all-release maybe-all-release
 maybe-all-release:
 @if release
-TARGET-release=all
 maybe-all-release: all-release
 all-release: configure-release
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd release && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-release))
+	(cd release && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif release
 
 .PHONY: check-release maybe-check-release
@@ -16218,15 +16124,13 @@
 .PHONY: all-recode maybe-all-recode
 maybe-all-recode:
 @if recode
-TARGET-recode=all
 maybe-all-recode: all-recode
 all-recode: configure-recode
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd recode && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-recode))
+	(cd recode && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif recode
 
 .PHONY: check-recode maybe-check-recode
@@ -16522,15 +16426,13 @@
 .PHONY: all-sed maybe-all-sed
 maybe-all-sed:
 @if sed
-TARGET-sed=all
 maybe-all-sed: all-sed
 all-sed: configure-sed
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd sed && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-sed))
+	(cd sed && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif sed
 
 .PHONY: check-sed maybe-check-sed
@@ -16826,15 +16728,13 @@
 .PHONY: all-send-pr maybe-all-send-pr
 maybe-all-send-pr:
 @if send-pr
-TARGET-send-pr=all
 maybe-all-send-pr: all-send-pr
 all-send-pr: configure-send-pr
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd send-pr && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-send-pr))
+	(cd send-pr && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif send-pr
 
 .PHONY: check-send-pr maybe-check-send-pr
@@ -17130,15 +17030,13 @@
 .PHONY: all-shellutils maybe-all-shellutils
 maybe-all-shellutils:
 @if shellutils
-TARGET-shellutils=all
 maybe-all-shellutils: all-shellutils
 all-shellutils: configure-shellutils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd shellutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-shellutils))
+	(cd shellutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif shellutils
 
 .PHONY: check-shellutils maybe-check-shellutils
@@ -17434,15 +17332,13 @@
 .PHONY: all-sid maybe-all-sid
 maybe-all-sid:
 @if sid
-TARGET-sid=all
 maybe-all-sid: all-sid
 all-sid: configure-sid
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd sid && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-sid))
+	(cd sid && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif sid
 
 .PHONY: check-sid maybe-check-sid
@@ -17738,15 +17634,13 @@
 .PHONY: all-sim maybe-all-sim
 maybe-all-sim:
 @if sim
-TARGET-sim=all
 maybe-all-sim: all-sim
 all-sim: configure-sim
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd sim && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-sim))
+	(cd sim && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif sim
 
 .PHONY: check-sim maybe-check-sim
@@ -18042,15 +17936,13 @@
 .PHONY: all-tar maybe-all-tar
 maybe-all-tar:
 @if tar
-TARGET-tar=all
 maybe-all-tar: all-tar
 all-tar: configure-tar
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd tar && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-tar))
+	(cd tar && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif tar
 
 .PHONY: check-tar maybe-check-tar
@@ -18346,15 +18238,13 @@
 .PHONY: all-texinfo maybe-all-texinfo
 maybe-all-texinfo:
 @if texinfo
-TARGET-texinfo=all
 maybe-all-texinfo: all-texinfo
 all-texinfo: configure-texinfo
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd texinfo && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-texinfo))
+	(cd texinfo && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif texinfo
 
 .PHONY: check-texinfo maybe-check-texinfo
@@ -18645,15 +18535,13 @@
 .PHONY: all-textutils maybe-all-textutils
 maybe-all-textutils:
 @if textutils
-TARGET-textutils=all
 maybe-all-textutils: all-textutils
 all-textutils: configure-textutils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd textutils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-textutils))
+	(cd textutils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif textutils
 
 .PHONY: check-textutils maybe-check-textutils
@@ -18949,15 +18837,13 @@
 .PHONY: all-time maybe-all-time
 maybe-all-time:
 @if time
-TARGET-time=all
 maybe-all-time: all-time
 all-time: configure-time
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd time && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-time))
+	(cd time && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif time
 
 .PHONY: check-time maybe-check-time
@@ -19253,15 +19139,13 @@
 .PHONY: all-uudecode maybe-all-uudecode
 maybe-all-uudecode:
 @if uudecode
-TARGET-uudecode=all
 maybe-all-uudecode: all-uudecode
 all-uudecode: configure-uudecode
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd uudecode && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-uudecode))
+	(cd uudecode && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif uudecode
 
 .PHONY: check-uudecode maybe-check-uudecode
@@ -19557,15 +19441,13 @@
 .PHONY: all-wdiff maybe-all-wdiff
 maybe-all-wdiff:
 @if wdiff
-TARGET-wdiff=all
 maybe-all-wdiff: all-wdiff
 all-wdiff: configure-wdiff
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd wdiff && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-wdiff))
+	(cd wdiff && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif wdiff
 
 .PHONY: check-wdiff maybe-check-wdiff
@@ -19861,15 +19743,13 @@
 .PHONY: all-zip maybe-all-zip
 maybe-all-zip:
 @if zip
-TARGET-zip=all
 maybe-all-zip: all-zip
 all-zip: configure-zip
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd zip && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-zip))
+	(cd zip && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif zip
 
 .PHONY: check-zip maybe-check-zip
@@ -20169,7 +20049,6 @@
 .PHONY: all-zlib maybe-all-zlib
 maybe-all-zlib:
 @if zlib
-TARGET-zlib=all
 maybe-all-zlib: all-zlib
 all-zlib: configure-zlib
 	@test -f stage_last && exit 0; \
@@ -20177,8 +20056,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd zlib && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-zlib))
+	(cd zlib && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif zlib
 
 .PHONY: check-zlib maybe-check-zlib
@@ -20464,15 +20342,13 @@
 .PHONY: all-gdb maybe-all-gdb
 maybe-all-gdb:
 @if gdb
-TARGET-gdb=all
 maybe-all-gdb: all-gdb
 all-gdb: configure-gdb
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-	  $(TARGET-gdb))
+	(cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all)
 @endif gdb
 
 .PHONY: check-gdb maybe-check-gdb
@@ -20768,15 +20644,13 @@
 .PHONY: all-expect maybe-all-expect
 maybe-all-expect:
 @if expect
-TARGET-expect=all
 maybe-all-expect: all-expect
 all-expect: configure-expect
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-	  $(TARGET-expect))
+	(cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all)
 @endif expect
 
 .PHONY: check-expect maybe-check-expect
@@ -21072,15 +20946,13 @@
 .PHONY: all-guile maybe-all-guile
 maybe-all-guile:
 @if guile
-TARGET-guile=all
 maybe-all-guile: all-guile
 all-guile: configure-guile
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-	  $(TARGET-guile))
+	(cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all)
 @endif guile
 
 .PHONY: check-guile maybe-check-guile
@@ -21376,15 +21248,13 @@
 .PHONY: all-tk maybe-all-tk
 maybe-all-tk:
 @if tk
-TARGET-tk=all
 maybe-all-tk: all-tk
 all-tk: configure-tk
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-	  $(TARGET-tk))
+	(cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all)
 @endif tk
 
 .PHONY: check-tk maybe-check-tk
@@ -21680,15 +21550,13 @@
 .PHONY: all-libtermcap maybe-all-libtermcap
 maybe-all-libtermcap:
 @if libtermcap
-TARGET-libtermcap=all
 maybe-all-libtermcap: all-libtermcap
 all-libtermcap: configure-libtermcap
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd libtermcap && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-libtermcap))
+	(cd libtermcap && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif libtermcap
 
 .PHONY: check-libtermcap maybe-check-libtermcap
@@ -21919,15 +21787,13 @@
 .PHONY: all-utils maybe-all-utils
 maybe-all-utils:
 @if utils
-TARGET-utils=all
 maybe-all-utils: all-utils
 all-utils: configure-utils
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd utils && $(MAKE) $(FLAGS_TO_PASS)  \
-	  $(TARGET-utils))
+	(cd utils && $(MAKE) $(FLAGS_TO_PASS)  all)
 @endif utils
 
 .PHONY: check-utils maybe-check-utils
diff --git a/Makefile.tpl b/Makefile.tpl
index 3fb09f7..d685c39 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -104,7 +104,6 @@
 # Some platforms don't like blank entries, so we remove duplicate,
 # leading and trailing colons.
 REALLY_SET_LIB_PATH = \
-  @SET_GCC_LIB_PATH@ \
   $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 # This is the list of directories to be built for the build system.
@@ -174,9 +173,7 @@
 	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
-	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	GMPINC="$(HOST_GMPINC)"; export GMPINC;
 
 # Similar, for later GCC stages.
 STAGE_HOST_EXPORTS = \
@@ -210,9 +207,7 @@
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
 	NM="$(NM_FOR_TARGET)"; export NM; \
 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
-	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES;
 
 RAW_CXX_TARGET_EXPORTS = \
 	$(BASE_TARGET_EXPORTS) \
@@ -909,7 +904,6 @@
 .PHONY: all-[+module+] maybe-all-[+module+]
 maybe-all-[+module+]:
 @if [+module+]
-TARGET-[+module+]=[+ IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
 maybe-all-[+module+]: all-[+module+]
 all-[+module+]: configure-[+module+]
 	@[+ IF bootstrap +]test -f stage_last && exit 0; \
@@ -917,8 +911,13 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
-	(cd [+module+] && $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] \
-	  $(TARGET-[+module+]))
+	(cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
+	  IF with_x 
+	    +] $(X11_FLAGS_TO_PASS)[+ 
+	  ENDIF with_x +] [+extra_make_flags+] [+
+	  IF (== (get "module") "gcc") +] \
+	    `if [ -f gcc/stage_last ]; then echo quickstrap ; else echo all; fi` [+
+	  ELSE +]all[+ ENDIF +])
 @endif [+module+]
 
 .PHONY: check-[+module+] maybe-check-[+module+]
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index de59638..27813dc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,595 +1,3 @@
-2004-10-18  Nick Clifton  <nickc@redhat.com>
-
-	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Compute
-	'name' for relocs against both local and global symbols.
-
-2004-10-16  Daniel Jacobowitz  <dan@debian.org>
-
-	* bfd-in2.h: Regenerate.
-	* bfd.c (struct bfd): Add no_export.
-	* elflink.c (elf_link_add_object_symbols): Handle no_export.
-
-2004-10-15  Alan Modra  <amodra@bigpond.net.au>
-
-	* config.bfd: Whitespace cleanup.
-	* Makefile.am: Run "make dep-am"
-	* Makefile.in: Regenerate.
-
-2004-10-15  Jakub Jelinek  <jakub@redhat.com>
-
-	* elflink.c (struct already_linked_section): Removed.
-	(try_match_symbols_in_sections, already_linked): Removed.
-	(_bfd_elf_section_already_linked): Skip ^\.gnu\.linkonce\.[^.]*\.
-	prefix of section names when finding already_linked_table
-	chain.  Compare section names.  Instead of calling already_linked,
-	do it inline and only for sections in the same already_linked_list.
-
-2004-10-15  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Add "info"
-	parameter.  If called after _bfd_elf_write_section_eh_frame,
-	don't allow a -2 return unless need_* bit is already set, and
-	handle offsets adjusted for output_offset.
-	* elf-bfd.h (_bfd_elf_eh_frame_section_offset): Update prototype.
-	* elf.c (_bfd_elf_section_offset): Update call.
-
-2004-10-13  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR 440
-	* coffcode.h (coff_compute_section_file_positions): Cast to
-	bfd_vma when computing page alignment.
-
-2004-10-13  Mark Mitchell  <mark@codesourcery.com>
-
-	* elf32-arm.h (elf32_arm_finish_dynamic_sections): Use file
-	offsets, not VMAs, for DT_VERSYM, DT_VERDEF, DT_VERNEED.
-
-2004-10-12  Mark Mitchell  <mark@codesourcery.com>
-
-	* elf32-arm.h (elf32_arm_finish_dynamic_symbol): Make .rel.plt
-	relocations use a virtual address, not a section offset.
-
-2004-10-12  Bob Wilson  <bob.wilson@acm.org>
-
-	* elf32-xtensa.c (elf_xtensa_get_private_bfd_flags): Delete.
-	(narrow_instruction, widen_instruction): Remove unnecessary calls to
-	xtensa_format_encode.
-	(ebb_propose_action): Inline call to ebb_add_proposed_action.
-	(ebb_add_proposed_action): Delete.
-
-2004-10-12  Bob Wilson  <bob.wilson@acm.org>
-
-	* elf32-xtensa.c: Use ISO C90 formatting.
-
-2004-10-12  Paul Brook  <paul@codesourcery.com>
-
-	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Rephrase error
-	message.
-
-2004-10-12  Paul Brook  <paul@codesourcery.com>
-
-	* elf32-arm.h: Support EABI version 4 objects.
-
-2004-10-12  Alan Modra  <amodra@bigpond.net.au>
-
-	PR 325
-	* cpu-i386.c (bfd_x86_64_arch_intel_syntax): Place last in chain.
-	Don't mark as default.
-	(bfd_x86_64_arch): Don't mark as default.
-
-2004-10-12  Alan Modra  <amodra@bigpond.net.au>
-
-	* elflink.c (enum action_discarded): New.
-	(elf_section_complain_discarded): Delete.
-	(elf_action_discarded): New function subsuming the above and also
-	controlling reloc behaviour.
-	(elf_link_input_bfd): Use it.
-
-2004-10-11  Jakub Jelinek  <jakub@redhat.com>
-
-	* elf.c (bfd_section_from_shdr): Handle SHT_GNU_LIBLIST.
-	(special_sections): Add .gnu.liblist and .gnu.conflict.
-	(assign_section_numbers): Handle SHT_GNU_LIBLIST.
-
-2004-10-11  Alan Modra  <amodra@bigpond.net.au>
-
-	PR 233
-	* elflink.c (elf_link_input_bfd): Try harder to support
-	relocations against symbols in removed linkonce sections.
-
-2004-10-11  Alan Modra  <amodra@bigpond.net.au>
-
-	* elflink.c (elf_link_input_bfd): Revert PR 354 change.
-
-	PR 354
-	* elflink.c (elf_link_input_bfd): Check that relocs in SEC_ALLOC
-	sections do not reference symbols in non-SEC_ALLOC sections.
-
-2004-10-11  Alan Modra  <amodra@bigpond.net.au>
-
-	PR 437
-	* elflink.c (elf_link_sort_relocs): Don't bomb on unusual sections.
-	(_bfd_elf_link_omit_section_dynsym): Formatting.
-
-2004-10-10  Alan Modra  <amodra@bigpond.net.au>
-
-	* libbfd-in.h (BFD_ASSERT, BFD_FAIL): Wrap macro body in do while.
-	* libbfd.h: Regnerate.
-	* elf32-cris.c: Add missing semicolon to BFD_ASSERTs.
-	* elf32-frv.c: Likewise.
-	* elf32-m32r.c: Likewise.
-	* elf32-ppc.c: Likewise.
-	* elf64-hppa.c: Likewise.
-	* elfxx-ia64.c: Likewise.
-	* opncls.c: Likewise.
-
-2004-10-10  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf-bfd.h (struct eh_frame_hdr_info): Add offsets_adjusted.
-	* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Adjust
-	offsets stored in struct eh_cie_fde entries before doing other
-	work.
-
-	* elf-bfd.h (struct eh_cie_fde): Add cie_inf, remove sec.
-	(struct eh_frame_hdr_info): Add last_cie_inf, remove last_cie_offset.
-	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete code
-	setting offsets for removed CIEs.  Don't set "sec", instead set
-	cie_inf for FDEs.  Keep a pointer to last struct eh_cie_fde for a
-	CIE in hdr_info.  Only set make_relative and make_lsda_relative
-	for CIEs.  Use pointers rather than array indices.
-	(_bfd_elf_eh_frame_section_offset): Test/set make_relative,
-	make_lsda_relative, need_* on cie_inf for FDEs.
-	(_bfd_elf_write_section_eh_frame): Adjust offset and new_offset for
-	section output_offset.  Delete cie_offset, instead use cie_inf
-	pointer to CIE entry.  Use need_relative and need_lsda_relative on
-	CIE entry for FDEs.  Use pointers rather than array indices.
-
-2004-10-09  Alan Modra  <amodra@bigpond.net.au>
-
-	* coff-rs6000.c (rs6000coff_vec): Add initializer for
-	bfd_is_target_special_symbol.
-	* coff64-rs6000.c (rs6000coff64_vec): Likewise.
-	* som.c (som_bfd_is_target_special_symbol): Define.
-
-2004-10-08  Nick Clifton  <nickc@redhat.com>
-
-	* configure.in: (AM_INIT_AUTOMAKE): Set version to 2.15.93.
-	* configure: Regenerate.
-	* bfd-in2.h: Regenerate.
-	* syms.c (bfd_is_target_special_symbol): New interface function.
-	Returns true when a symbol should be considered to be special.
-	* targets.c (bfd_target): Include bfd_is_target_special_symbol in
-	the symbol jump table.
-	* elf32-arm.h (elf32_arm_is_target_special_symbol): New function.
-	Return true iff the symbol is a mapping symbol.
-	(bfd_elf32_bfd_is_target_special_symbol): Define.
-	* elfxx-target.h: Provide a default definition for
-	bfd_is_target_special_symbol.
-	* aout-target.h: Likewise.
-	* aout-tic30.c: Likewise.
-	* binary.c: Likewise.
-	* coffcode.h: Likewise.
-	* i386msdos.c: Likewise.
-	* ieee.c: Likewise.
-	* ihex.c: Likewise.
-	* libaout.h: Likewise.
-	* libbfd-in.h: Likewise
-	* libecoff.h: Likewise.
-	* mach-o.c: Likewise.
-	* mmo.c: Likewise.
-	* nlm-target.h: Likewise.
-	* oasys.c: Likewise.
-	* pef.c: Likewise.
-	* ppcboot.c: Likewise.
-	* srec.c: Likewise.
-	* tekhex.c: Likewise.
-	* versados.c: Likewise.
-	* vms.c: Likewise.
-	* xcoff-target.h: Likewise.
-	* xsym.c: Likewise.
-	* libbfd.h: Regenerate.
-
-2004-10-08  Daniel Jacobowitz  <dan@debian.org>
-
-	* config.bfd: Include 64-bit support for i[3-7]86-*-solaris2*.
-	* elf64-x86-64.c (elf64_x86_64_section_from_shdr): New function.
-	(elf_backend_section_from_shdr): Define.
-
-2004-10-08  Alan Modra  <amodra@bigpond.net.au>
-
-	* syms.c (bfd_is_local_label): Return false for file symbols.
-
-2004-10-07  Bob Wilson  <bob.wilson@acm.org>
-	    David Heine  <dlheine@tensilica.com>
-
-	* elf32-xtensa.c (elf32xtensa_size_opt): New global variable.
-	(xtensa_default_isa): Global variable moved here from xtensa-isa.c.
-	(elf32xtensa_no_literal_movement): New global variable.
-	(elf_howto_table): Add entries for new relocations.
-	(elf_xtensa_reloc_type_lookup): Handle new relocations.
-	(property_table_compare): When addresses are equal, compare sizes and
-	various property flags.
-	(property_table_matches): New.
-	(xtensa_read_table_entries): Extend to read new property tables.  Add
-	output_addr parameter to indicate that output addresses should be used.
-	Use bfd_get_section_limit.
-	(elf_xtensa_find_property_entry): New.
-	(elf_xtensa_in_literal_pool): Use elf_xtensa_find_property_entry.
-	(elf_xtensa_check_relocs): Handle new relocations.
-	(elf_xtensa_do_reloc): Use bfd_get_section_limit.  Handle new
-	relocations.  Use new xtensa-isa.h functions.
-	(build_encoding_error_message): Remove encode_result parameter.  Add
-	new target_address parameter used to detect alignment errors.
-	(elf_xtensa_relocate_section): Use bfd_get_section_limit.  Clean up
-	error handling.  Use new is_operand_relocation function.
-	(elf_xtensa_combine_prop_entries, elf_xtensa_merge_private_bfd_data):
-	Use underbar macro for error messages.  Formatting.
-	(get_const16_opcode): New.
-	(get_l32r_opcode): Add a separate flag for initialization.
-	(get_relocation_opnd): Operand number is no longer explicit in the
-	relocation.  Change to decode the opcode and analyze its operands.
-	(get_relocation_slot): New.
-	(get_relocation_opcode): Add bfd parameter.  Use bfd_get_section_limit.
-	Use new xtensa-isa.h functions to handle multislot instructions.
-	(is_l32r_relocation): Add bfd parameter.  Use is_operand_relocation.
-	(get_asm_simplify_size, is_alt_relocation, is_operand_relocation,
-	insn_decode_len, insn_decode_opcode, check_branch_target_aligned,
-	check_loop_aligned, check_branch_target_aligned_address, narrowable,
-	widenable, narrow_instruction, widen_instruction, op_single_fmt_table,
-	get_single_format, init_op_single_format_table): New.
-	(elf_xtensa_do_asm_simplify): Add error_message parameter and use it
-	instead of calling _bfd_error_handler.  Use new xtensa-isa.h functions.
-	(contract_asm_expansion): Add error_message parameter and pass it to
-	elf_xtensa_do_asm_simplify.  Replace use of R_XTENSA_OP0 relocation
-	with R_XTENSA_SLOT0_OP.
-	(get_expanded_call_opcode): Extend to handle either L32R or CONST16
-	instructions.  Use new xtensa-isa.h functions.
-	(r_reloc struct): Add new virtual_offset field.
-	(r_reloc_init): Add contents and content_length parameters.  Set
-	virtual_offset field to zero.  Add contents to target_offset field for
-	partial_inplace relocations.
-	(r_reloc_is_defined): Check for null.
-	(print_r_reloc): New debug function.
-	(source_reloc struct): Replace xtensa_operand field with pair of the
-	opcode and the operand position.  Add is_abs_literal field.
-	(init_source_reloc): Specify operand by opcode/position pair.  Set
-	is_abs_literal field.
-	(source_reloc_compare): When target_offsets are equal, compare other
-	fields to make sorting predictable.
-	(literal_value struct): Add is_abs_literal field.
-	(value_map_hash_table struct): Add has_last_loc and last_loc fields.
-	(init_literal_value): New.
-	(is_same_value): Replace with ...
-	(literal_value_equal): ... this function.  Add comparisons of
-	virtual_offset and is_abs_literal fields.
-	(value_map_hash_table_init): Use bfd_zmalloc.  Check for allocation
-	failure.  Initialize has_last_loc field.
-	(value_map_hash_table_delete): New.
-	(hash_literal_value): Rename to ...
-	(literal_value_hash): ... this.  Include is_abs_literal flag and
-	virtual_offset field in the hash value.
-	(get_cached_value): Rename to ...
-	(value_map_get_cached_value): ... this.  Update calls to
-	literal_value_hash and literal_value_equal.
-	(add_value_map): Check for allocation failure.  Update calls to
-	value_map_get_cached_value and literal_value_hash.
-	(text_action, text_action_list, text_action_t): New types.
-	(find_fill_action, compute_removed_action_diff, adjust_fill_action,
-	text_action_add, text_action_add_literal, offset_with_removed_text,
-	offset_with_removed_text_before_fill, find_insn_action,
-	print_action_list, print_removed_literals): New.
-	(offset_with_removed_literals): Delete.
-	(xtensa_relax_info struct): Add is_relaxable_asm_section, action_list,
-	fix_array, fix_array_count, allocated_relocs, relocs_count, and
-	allocated_relocs_count fields.
-	(init_xtensa_relax_info): Initialize new fields.
-	(reloc_bfd_fix struct): Add new translated field.
-	(reloc_bfd_fix_init): Add translated parameter and use it to set the
-	translated field.
-	(fix_compare, cache_fix_array): New.
-	(get_bfd_fix): Remove fix_list parameter and get all relax_info for the
-	section via get_xtensa_relax_info.  Use cache_fix_array to set up
-	sorted fix_array and use bsearch instead of linear search.
-	(section_cache_t): New struct.
-	(init_section_cache, section_cache_section, clear_section_cache): New.
-	(ebb_t, ebb_target_enum, proposed_action, ebb_constraint): New types.
-	(init_ebb_constraint, free_ebb_constraint, init_ebb, extend_ebb_bounds,
-	extend_ebb_bounds_forward, extend_ebb_bounds_backward,
-	insn_block_decodable_len, ebb_propose_action, ebb_add_proposed_action):
-	New.
-	(retrieve_contents): Use bfd_get_section_limit.
-	(elf_xtensa_relax_section): Add relocations_analyzed flag.  Update call
-	to compute_removed_literals.  Free value_map_hash_table when no longer
-	needed.
-	(analyze_relocations): Check is_relaxable_asm_section flag.  Call
-	compute_text_actions for all sections.
-	(find_relaxable_sections): Mark sections as relaxable if they contain
-	ASM_EXPAND relocations that can be optimized.  Adjust r_reloc_init
-	call.  Increment relax_info src_count field only for appropriate
-	relocation types.  Remove is_literal_section check.
-	(collect_source_relocs): Use bfd_get_section_limit.  Adjust calls to
-	r_reloc_init and find_associated_l32r_irel.  Check
-	is_relaxable_asm_section flag.  Handle L32R instructions with absolute
-	literals.  Pass is_abs_literal flag to init_source_reloc.
-	(is_resolvable_asm_expansion): Use bfd_get_section_limit.  Check for
-	CONST16 instructions.  Adjust calls to r_reloc_init and
-	pcrel_reloc_fits.  Handle weak symbols conservatively.
-	(find_associated_l32r_irel): Add bfd parameter and pass it to
-	is_l32r_relocation.
-	(compute_text_actions, compute_ebb_proposed_actions,
-	compute_ebb_actions, check_section_ebb_pcrels_fit,
-	check_section_ebb_reduces, text_action_add_proposed,
-	compute_fill_extra_space): New.
-	(remove_literals): Replace with ...
-	(compute_removed_literals): ... this function.  Call
-	init_section_cache.  Use bfd_get_section_limit.  Sort internal_relocs.
-	Call xtensa_read_table_entries to get the property table.  Skip
-	relocations other than R_XTENSA_32 and R_XTENSA_PLT.  Use new
-	is_removable_literal, remove_dead_literal, and
-	identify_literal_placement functions.
-	(get_irel_at_offset): Rewrite to use bsearch on sorted relocations
-	instead of linear search.
-	(is_removable_literal, remove_dead_literal,
-	identify_literal_placement): New.
-	(relocations_reach): Update check for literal not referenced by any
-	PC-relative relocations.  Adjust call to pcrel_reloc_fits.
-	(coalesce_shared_literal, move_shared_literal): New.
-	(relax_section): Use bfd_get_section_limit.  Call
-	translate_section_fixes.  Update calls to r_reloc_init and
-	offset_with_removed_text.  Check new is_relaxable_asm_section flag.
-	Add call to pin_internal_relocs.  Add special handling for
-	R_XTENSA_ASM_SIMPLIFY and R_XTENSA_DIFF* relocs.  Use virtual_offset
-	info to calculate new addend_displacement variable.  Replace code for
-	deleting literals with more general code to perform the actions
-	determined by the action_list for the section.
-	(translate_section_fixes, translate_reloc_bfd_fix): New.
-	(translate_reloc): Check new is_relaxable_asm_section flag.  Call
-	find_removed_literal only if is_operand_relocation.  Update call to
-	offset_with_removed_text.  Use new target_offset and removed_bytes
-	variables.
-	(move_literal): New.
-	(relax_property_section):  Use bfd_get_section_limit.  Set new
-	is_full_prop_section flag and handle new property tables.  Update calls
-	to r_reloc_init and offset_with_removed_text.  Check
-	is_relaxable_asm_section flag.  Handle expansion of zero-sized
-	unreachable entries, with use of offset_with_removed_text_before_fill.
-	For relocatable links, combine entries only for literal tables.
-	(relax_section_symbols): Check is_relaxable_asm_section flag.  Update
-	calls to offset_with_removed_text.  Translate st_size field for
-	function symbols.
-	(do_fix_for_relocatable_link): Change to return bfd_boolean to indicate
-	failure.  Add contents parameter.  Update call to get_bfd_fix.  Update
-	call to r_reloc_init.  Call _bfd_error_handler and return FALSE for
-	R_XTENSA_ASM_EXPAND relocs.
-	(do_fix_for_final_link): Add input_bfd and contents parameters.  Update
-	call to get_bfd_fix.  Include offset from contents for partial_inplace
-	relocations.
-	(is_reloc_sym_weak): New.
-	(pcrel_reloc_fits): Use new xtensa-isa.h functions.
-	(prop_sec_len): New.
-	(xtensa_is_property_section): Handle new property sections.
-	(is_literal_section): Delete.
-	(internal_reloc_compare): When r_offset matches, compare r_info and
-	r_addend to make sorting predictable.
-	(internal_reloc_matches): New.
-	(xtensa_get_property_section_name): Handle new property sections.
-	(xtensa_get_property_predef_flags): New.
-	(xtensa_callback_required_dependence): Use bfd_get_section_limit.
-	Update calls to xtensa_isa_init, is_l32r_relocation, and r_reloc_init.
-	* xtensa-isa.c (xtensa_default_isa): Moved to elf32-xtensa.c.
-	(xtisa_errno, xtisa_error_msg): New variables.
-	(xtensa_isa_errno, xtensa_isa_error_msg): New.
-	(xtensa_insnbuf_alloc): Add error handling.
-	(xtensa_insnbuf_to_chars): Add num_chars parameter.  Update to
-	use xtensa_format_decode.  Add error handling.
-	(xtensa_insnbuf_from_chars): Add num_chars parameter.  Decode the
-	instruction length to find the number of bytes to copy.
-	(xtensa_isa_init): Add error handling.  Replace calls to
-	xtensa_load_isa and xtensa_extend_isa with code to initialize lookup
-	tables in the xtensa_modules structure.
-	(xtensa_check_isa_config, xtensa_add_isa, xtensa_load_isa,
-	xtensa_extend_isa): Delete.
-	(xtensa_isa_free): Change to only free lookup tables.
-	(opname_lookup_compare): Replace with ...
-	(xtensa_isa_name_compare): ... this function.  Use strcasecmp.
-	(xtensa_insn_maxlength): Rename to ...
-	(xtensa_isa_maxlength): ... this.
-	(xtensa_insn_length): Delete.
-	(xtensa_insn_length_from_first_byte): Replace with ...
-	(xtensa_isa_length_from_chars): ... this function.
-	(xtensa_num_opcodes): Rename to ...
-	(xtensa_isa_num_opcodes): ... this.
-	(xtensa_isa_num_pipe_stages, xtensa_isa_num_formats,
-	xtensa_isa_num_regfiles, xtensa_isa_num_stages,
-	xtensa_isa_num_sysregs, xtensa_isa_num_interfaces,
-	xtensa_isa_num_funcUnits, xtensa_format_name, xtensa_format_lookup,
-	xtensa_format_decode, xtensa_format_encode, xtensa_format_length,
-	xtensa_format_num_slots, xtensa_format_slot_nop_opcode,
-	xtensa_format_get_slot, xtensa_format_set_slot): New functions.
-	(xtensa_opcode_lookup): Add error handling.
-	(xtensa_decode_insn): Replace with ...
-	(xtensa_opcode_decode): ... this function, with new format and
-	slot parameters.  Add error handling.
-	(xtensa_encode_insn): Replace with ...
-	(xtensa_opcode_encode): ... this function, which does the encoding via
-	one of the entries in the "encode_fns" array.  Add error handling.
-	(xtensa_opcode_name): Add error handling.
-	(xtensa_opcode_is_branch, xtensa_opcode_is_jump, xtensa_opcode_is_loop,
-	xtensa_opcode_is_call): New.
-	(xtensa_num_operands): Replace with ...
-	(xtensa_opcode_num_operands): ... this function.  Add error handling.
-	(xtensa_opcode_num_stateOperands,
-	xtensa_opcode_num_interfaceOperands, xtensa_opcode_num_funcUnit_uses,
-	xtensa_opcode_funcUnit_use, xtensa_operand_name,
-	xtensa_operand_is_visible): New.
-	(xtensa_get_operand, xtensa_operand_kind): Delete.
-	(xtensa_operand_inout): Add error handling and special-case for
-	"sout" operands.
-	(xtensa_operand_get_field, xtensa_operand_set_field): Rewritten to
-	operate on one slot of an instruction.  Added error handling.
-	(xtensa_operand_encode): Handle default operands with no encoding
-	functions.  Check for success by comparing against decoded value.
-	Add error handling.
-	(xtensa_operand_decode): Handle default operands.  Return decoded value
-	through argument pointer.  Add error handling.
-	(xtensa_operand_is_register, xtensa_operand_regfile,
-	xtensa_operand_num_regs, xtensa_operand_is_known_reg): New.
-	(xtensa_operand_isPCRelative): Rename to ...
-	(xtensa_operand_is_PCrelative): ... this.  Add error handling.
-	(xtensa_operand_do_reloc, xtensa_operand_undo_reloc): Return value
-	through argument pointer.  Add error handling.
-	(xtensa_stateOperand_state, xtensa_stateOperand_inout,
-	xtensa_interfaceOperand_interface, xtensa_regfile_lookup,
-	xtensa_regfile_lookup_shortname, xtensa_regfile_name,
-	xtensa_regfile_shortname, xtensa_regfile_view_parent,
-	xtensa_regfile_num_bits, xtensa_regfile_num_entries,
-	xtensa_state_lookup, xtensa_state_name, xtensa_state_num_bits,
-	xtensa_state_is_exported, xtensa_sysreg_lookup,
-	xtensa_sysreg_lookup_name, xtensa_sysreg_name, xtensa_sysreg_number,
-	xtensa_sysreg_is_user, xtensa_interface_lookup, xtensa_interface_name,
-	xtensa_interface_num_bits, xtensa_interface_inout,
-	xtensa_interface_has_side_effect, xtensa_funcUnit_lookup,
-	xtensa_funcUnit_name, xtensa_funcUnit_num_copies): New.
-	* xtensa-modules.c: Rewrite to use new data structures.
-	* reloc.c (BFD_RELOC_XTENSA_DIFF8, BFD_RELOC_XTENSA_DIFF16,
-	BFD_RELOC_XTENSA_DIFF32, BFD_RELOC_XTENSA_SLOT0_OP,
-	BFD_RELOC_XTENSA_SLOT1_OP, BFD_RELOC_XTENSA_SLOT2_OP,
-	BFD_RELOC_XTENSA_SLOT3_OP, BFD_RELOC_XTENSA_SLOT4_OP,
-	BFD_RELOC_XTENSA_SLOT5_OP, BFD_RELOC_XTENSA_SLOT6_OP,
-	BFD_RELOC_XTENSA_SLOT7_OP, BFD_RELOC_XTENSA_SLOT8_OP,
-	BFD_RELOC_XTENSA_SLOT9_OP, BFD_RELOC_XTENSA_SLOT10_OP,
-	BFD_RELOC_XTENSA_SLOT11_OP, BFD_RELOC_XTENSA_SLOT12_OP,
-	BFD_RELOC_XTENSA_SLOT13_OP, BFD_RELOC_XTENSA_SLOT14_OP,
-	BFD_RELOC_XTENSA_SLOT0_ALT, BFD_RELOC_XTENSA_SLOT1_ALT,
-	BFD_RELOC_XTENSA_SLOT2_ALT, BFD_RELOC_XTENSA_SLOT3_ALT,
-	BFD_RELOC_XTENSA_SLOT4_ALT, BFD_RELOC_XTENSA_SLOT5_ALT,
-	BFD_RELOC_XTENSA_SLOT6_ALT, BFD_RELOC_XTENSA_SLOT7_ALT,
-	BFD_RELOC_XTENSA_SLOT8_ALT, BFD_RELOC_XTENSA_SLOT9_ALT,
-	BFD_RELOC_XTENSA_SLOT10_ALT, BFD_RELOC_XTENSA_SLOT11_ALT,
-	BFD_RELOC_XTENSA_SLOT12_ALT, BFD_RELOC_XTENSA_SLOT13_ALT,
-	BFD_RELOC_XTENSA_SLOT14_ALT): Add new relocations.
-	* Makefile.am (xtensa-isa.lo, xtensa-modules.lo): Update dependencies.
-	* Makefile.in: Regenerate.
-	* bfd-in2.h: Likewise.
-	* libbfd.h: Likewise.
-
-2004-10-07  Richard Sandiford  <rsandifo@redhat.com>
-
-	* elf64-mips.c (mips_elf64_write_rel): Use STN_UNDEF for relocs
-	against the absolute section.
-	(mips_elf64_write_rela): Likewise.
-
-2004-10-07  Jan Beulich <jbeulich@novell.com>
-
-	* elf.c (elf_find_function): Don't generally check for matching
-	section, just for non-file symbols.  Remove redunant comparison
-	for the latter.
-	* elf32-arm.h (arm_elf_find_function): Likewise.
-
-2004-10-07  Jeff Baker  <jbaker@qnx.com>
-
-	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to warn if
-	adding a DT_TEXTREL to a shared object and --warn-shared-textrel
-	was specified.
-
-2004-10-04  Roland McGrath  <roland@redhat.com>
-
-	* hash.c (bfd_hash_set_default_size): Use const for table.
-	Use size_t instead of int for variable compared to sizeof results.
-
-2004-10-05  Alan Modra  <amodra@bigpond.net.au>
-
-	PR 425
-	* syms.c (_bfd_stab_section_find_nearest_line): Ignore R_*_NONE relocs.
-
-2004-10-01  Paul Brook  <paul@codesourcery.com>
-
-	* elf32-arm.h (elf32_arm_fake_sections,
-	is_arm_elf_unwind_section_name, elf32_arm_section_from_shdr): New
-	functions.
-	(elf_backend_fake_sections, elf_backend_section_from_shdr): Define.
-
-2004-10-01  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf-bfd.h (struct eh_cie_fde): Add need_relative and
-	need_lsda_relative.
-	* elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Set
-	need_relative or need_lsda_relative if we are processing an
-	offset for a reloc on a FDE initial loc or LSDA field
-	respectively.
-	(_bfd_elf_write_section_eh_frame): Test need_relative and
-	need_lsda_relative in place of corresponding make_* field
-	when deciding to use pc-relative encodings.
-
-2004-09-30  Paul Brook  <paul@codesourcery.com>
-
-	* elf32-arm.h (bfd_elf32_arm_set_target_relocs): Handle "abs"
-	target2 relocation type.
-
-2004-09-30  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR 414
-	* elflink.c (_bfd_elf_merge_symbol): Check TLS symbol.
-
-2004-09-30  Paul Brook  <paul@codesourcery.com>
-
-	* reloc.c: Add BFD_RELOC_ARM_SMI.
-	* bfd-in2.h: Regenerate.
-	* libbfd.h: Ditto.
-
-2004-09-24  Alan Modra  <amodra@bigpond.net.au>
-
-	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Add output section
-	vma and output offset to address.
-	* simple.c (simple_save_output_info): Only set output section
-	and offset for debug sections, or those not already set up by
-	the linker.
-	(bfd_simple_get_relocated_section_contents): Update comment.
-
-2004-09-24  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf.c (IS_LOADED): Delete.
-	(assign_file_positions_for_segments): Just test SEC_LOAD instead.
-	Restore SEC_HAS_CONTENTS test to the one place it was used prior
-	to 2004-09-22.
-
-2004-09-23  Alan Modra  <amodra@bigpond.net.au>
-
-	PR gas/396
-	* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
-	bfd_mach_sparc_sparclet and bfd_mach_sparc_sparclite.  Remove
-	redundant assignment of EM_SPARC.
-
-2004-09-22  Brian Ford  <ford@vss.fsi.com>
-
-	* pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
-	alignment for .rdata sections so sse[2] code works with gcc >= 3.3.3
-	constants.
-	* pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2004-09-22  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf32-ppc.c (ppc_elf_modify_segment_map): Delete.
-	(elf_backend_modify_segment_map): Don't define.
-
-2004-09-22  Alan Modra  <amodra@bigpond.net.au>
-
-	* elf.c (IS_LOADED): Define.
-	(assign_file_positions_for_segments): Don't round up file offset of
-	PT_LOAD segments containing no SEC_LOAD sections, instead round down.
-	Delete code handling link script adjustment of lma.  Do the adjust
-	in later code handling similar ajustments.  Remove dead code error
-	check.  Warn if section lma would require a negative offset
-	adjustment.  Tweak lma adjustment to use p_filesz rather than p_memsz.
-	Use p_vaddr + p_memsz inside section loop in place of voff.  Don't
-	update voff in section loop.  Change voff in segment loop to be an
-	adjustment on top of "off".  Set sec->filepos and update "off" later.
-	Test for loadable sections consistently using IS_LOADED.  Similarly,
-	test for alloc-only sections other than .tbss consistently.
-	Don't bother checking SEC_ALLOC in PT_LOAD segments.  Remove FIXME.
-	Tidy PT_NOTE handling.  Use %B and %A in error messages.
-	(assign_file_positions_except_relocs): Use %B in error message.
-
 2004-09-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* Makefile.am (AUTOMAKE_OPTIONS): Require 1.9.
@@ -811,7 +219,7 @@
 	* elfarm-nabi.c (elf32_arm_symbian_modify_segment_map): Add a
 	PT_DYNAMIC segment.
 	(elf_backend_want_got_plt): Define to zero for Symbian OS.
-
+	
 2004-09-06  Nick Clifton  <nickc@redhat.com>
 
 	* elflink.c (elf_link_add_object_symbols): Set the error code to
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 17c9214..a7eabfc 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1557,7 +1557,7 @@
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
   libxcoff.h
 xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
-xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/xtensa-isa.h \
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
   $(INCDIR)/xtensa-isa-internal.h
 xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
   $(INCDIR)/xtensa-isa-internal.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 2c7da66..ac92e49 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -2112,7 +2112,7 @@
   $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
   libxcoff.h
 xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
-xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/xtensa-isa.h \
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
   $(INCDIR)/xtensa-isa-internal.h
 xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
   $(INCDIR)/xtensa-isa-internal.h
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 913339f..a169704 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -579,10 +579,6 @@
 #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
 #endif
 
-#ifndef MY_bfd_is_target_special_symbol
-#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#endif
-
 #ifndef MY_bfd_free_cached_info
 #define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
 #endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 850c558..a9c06ff 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -1036,11 +1036,6 @@
 #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
 #endif
 
-#ifndef MY_bfd_is_target_special_symbol
-#define MY_bfd_is_target_special_symbol  \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#endif
-
 #ifndef MY_bfd_free_cached_info
 #define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
 #endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a25bef3..4be38cf 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2618,7 +2618,6 @@
   BFD_RELOC_ARM_ADRL_IMMEDIATE,
   BFD_RELOC_ARM_OFFSET_IMM,
   BFD_RELOC_ARM_SHIFT_IMM,
-  BFD_RELOC_ARM_SMI,
   BFD_RELOC_ARM_SWI,
   BFD_RELOC_ARM_MULTI,
   BFD_RELOC_ARM_CP_OFF_IMM,
@@ -3621,56 +3620,9 @@
 PLT entries.  Otherwise, this is just a generic 32-bit relocation.  */
   BFD_RELOC_XTENSA_PLT,
 
-/* Xtensa relocations to mark the difference of two local symbols.
-These are only needed to support linker relaxation and can be ignored
-when not relaxing.  The field is set to the value of the difference
-assuming no relaxation.  The relocation encodes the position of the
-first symbol so the linker can determine whether to adjust the field
-value.  */
-  BFD_RELOC_XTENSA_DIFF8,
-  BFD_RELOC_XTENSA_DIFF16,
-  BFD_RELOC_XTENSA_DIFF32,
-
-/* Generic Xtensa relocations for instruction operands.  Only the slot
-number is encoded in the relocation.  The relocation applies to the
-last PC-relative immediate operand, or if there are no PC-relative
-immediates, to the last immediate operand.  */
-  BFD_RELOC_XTENSA_SLOT0_OP,
-  BFD_RELOC_XTENSA_SLOT1_OP,
-  BFD_RELOC_XTENSA_SLOT2_OP,
-  BFD_RELOC_XTENSA_SLOT3_OP,
-  BFD_RELOC_XTENSA_SLOT4_OP,
-  BFD_RELOC_XTENSA_SLOT5_OP,
-  BFD_RELOC_XTENSA_SLOT6_OP,
-  BFD_RELOC_XTENSA_SLOT7_OP,
-  BFD_RELOC_XTENSA_SLOT8_OP,
-  BFD_RELOC_XTENSA_SLOT9_OP,
-  BFD_RELOC_XTENSA_SLOT10_OP,
-  BFD_RELOC_XTENSA_SLOT11_OP,
-  BFD_RELOC_XTENSA_SLOT12_OP,
-  BFD_RELOC_XTENSA_SLOT13_OP,
-  BFD_RELOC_XTENSA_SLOT14_OP,
-
-/* Alternate Xtensa relocations.  Only the slot is encoded in the
-relocation.  The meaning of these relocations is opcode-specific.  */
-  BFD_RELOC_XTENSA_SLOT0_ALT,
-  BFD_RELOC_XTENSA_SLOT1_ALT,
-  BFD_RELOC_XTENSA_SLOT2_ALT,
-  BFD_RELOC_XTENSA_SLOT3_ALT,
-  BFD_RELOC_XTENSA_SLOT4_ALT,
-  BFD_RELOC_XTENSA_SLOT5_ALT,
-  BFD_RELOC_XTENSA_SLOT6_ALT,
-  BFD_RELOC_XTENSA_SLOT7_ALT,
-  BFD_RELOC_XTENSA_SLOT8_ALT,
-  BFD_RELOC_XTENSA_SLOT9_ALT,
-  BFD_RELOC_XTENSA_SLOT10_ALT,
-  BFD_RELOC_XTENSA_SLOT11_ALT,
-  BFD_RELOC_XTENSA_SLOT12_ALT,
-  BFD_RELOC_XTENSA_SLOT13_ALT,
-  BFD_RELOC_XTENSA_SLOT14_ALT,
-
-/* Xtensa relocations for backward compatibility.  These have all been
-replaced by BFD_RELOC_XTENSA_SLOT0_OP.  */
+/* Generic Xtensa relocations.  Only the operand number is encoded
+in the relocation.  The details are determined by extracting the
+instruction opcode.  */
   BFD_RELOC_XTENSA_OP0,
   BFD_RELOC_XTENSA_OP1,
   BFD_RELOC_XTENSA_OP2,
@@ -3828,11 +3780,6 @@
 #define bfd_is_local_label_name(abfd, name) \
   BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
 
-bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
-
-#define bfd_is_target_special_symbol(abfd, sym) \
-  BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-
 #define bfd_canonicalize_symtab(abfd, location) \
   BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
 
@@ -3962,9 +3909,6 @@
   /* Pointer to structure which contains architecture information.  */
   const struct bfd_arch_info *arch_info;
 
-  /* Flag set if symbols from this BFD should not be exported.  */
-  bfd_boolean no_export;
-
   /* Stuff only useful for archives.  */
   void *arelt_data;
   struct bfd *my_archive;      /* The containing archive BFD.  */
@@ -4451,7 +4395,6 @@
   NAME##_print_symbol, \
   NAME##_get_symbol_info, \
   NAME##_bfd_is_local_label_name, \
-  NAME##_bfd_is_target_special_symbol, \
   NAME##_get_lineno, \
   NAME##_find_nearest_line, \
   NAME##_bfd_make_debug_symbol, \
@@ -4470,7 +4413,7 @@
     (bfd *, struct bfd_symbol *, symbol_info *);
 #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
   bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-  bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
+
   alent *     (*_get_lineno) (bfd *, struct bfd_symbol *);
   bfd_boolean (*_bfd_find_nearest_line)
     (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 0126a9f..8ebc81a 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -133,9 +133,6 @@
 .  {* Pointer to structure which contains architecture information.  *}
 .  const struct bfd_arch_info *arch_info;
 .
-.  {* Flag set if symbols from this BFD should not be exported.  *}
-.  bfd_boolean no_export;
-.
 .  {* Stuff only useful for archives.  *}
 .  void *arelt_data;
 .  struct bfd *my_archive;      {* The containing archive BFD.  *}
diff --git a/bfd/binary.c b/bfd/binary.c
index 4528672..4335a28 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -234,7 +234,6 @@
   bfd_symbol_info (symbol, ret);
 }
 
-#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define binary_get_lineno _bfd_nosymbols_get_lineno
 #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index d1df0a2..9fe9cbd 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4169,7 +4169,6 @@
     coff_print_symbol,
     coff_get_symbol_info,
     _bfd_xcoff_is_local_label_name,
-    coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
     coff_bfd_make_debug_symbol,
@@ -4416,7 +4415,6 @@
     coff_print_symbol,
     coff_get_symbol_info,
     _bfd_xcoff_is_local_label_name,
-    coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
     coff_bfd_make_debug_symbol,
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index b33658a..0e24adb 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2710,7 +2710,6 @@
     coff_print_symbol,
     coff_get_symbol_info,
     _bfd_xcoff_is_local_label_name,
-    coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
     coff_bfd_make_debug_symbol,
@@ -2958,7 +2957,6 @@
     coff_print_symbol,
     coff_get_symbol_info,
     _bfd_xcoff_is_local_label_name,
-    coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
     coff_bfd_make_debug_symbol,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 7bfdc6b..51d00c6 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3243,7 +3243,7 @@
 #ifdef COFF_PAGE_SIZE
       if ((abfd->flags & D_PAGED) != 0
 	  && (current->flags & SEC_ALLOC) != 0)
-	sofar += (current->vma - (bfd_vma) sofar) % page_size;
+	sofar += (current->vma - sofar) % page_size;
 #endif
       current->filepos = sofar;
 
@@ -5547,10 +5547,6 @@
 #define coff_bfd_is_local_label_name	    _bfd_coff_is_local_label_name
 #endif
 
-#ifndef coff_bfd_is_target_special_symbol
-#define coff_bfd_is_target_special_symbol   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#endif
-
 #ifndef coff_read_minisymbols
 #define coff_read_minisymbols		    _bfd_generic_read_minisymbols
 #endif
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 549397b..d4e0e60 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -47,38 +47,38 @@
 
 targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 case "${targ_cpu}" in
-alpha*)		 targ_archs=bfd_alpha_arch ;;
-arm*)		 targ_archs=bfd_arm_arch ;;
-c30*)		 targ_archs=bfd_tic30_arch ;;
-c4x*)		 targ_archs=bfd_tic4x_arch ;;
-c54x*)		 targ_archs=bfd_tic54x_arch ;;
-crx*)		 targ_archs=bfd_crx_arch ;;
+alpha*)          targ_archs=bfd_alpha_arch ;;
+arm*)	         targ_archs=bfd_arm_arch ;;
+c30*)	         targ_archs=bfd_tic30_arch ;;
+c4x*)            targ_archs=bfd_tic4x_arch ;;
+c54x*)	         targ_archs=bfd_tic54x_arch ;;
+crx*)            targ_archs=bfd_crx_arch ;;
 dlx*)		 targ_archs=bfd_dlx_arch ;;
-hppa*)		 targ_archs=bfd_hppa_arch ;;
-i[3-7]86)	 targ_archs=bfd_i386_arch ;;
-i370)		 targ_archs=bfd_i370_arch ;;
+hppa*)	         targ_archs=bfd_hppa_arch ;;
+i[3-7]86)       targ_archs=bfd_i386_arch ;;
+i370)            targ_archs=bfd_i370_arch ;;
 m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
 m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
-m68*)		 targ_archs=bfd_m68k_arch ;;
-m88*)		 targ_archs=bfd_m88k_arch ;;
-mips*)		 targ_archs=bfd_mips_arch ;;
+m68*)	         targ_archs=bfd_m68k_arch ;;
+m88*)	         targ_archs=bfd_m88k_arch ;;
+mips*)	         targ_archs=bfd_mips_arch ;;
 or32*)		 targ_archs=bfd_or32_arch ;;
-pdp11*)		 targ_archs=bfd_pdp11_arch ;;
-pj*)		 targ_archs="bfd_pj_arch bfd_i386_arch";;
-powerpc*)	 targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-rs6000)		 targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-s390*)		 targ_archs=bfd_s390_arch ;;
-sh*)		 targ_archs=bfd_sh_arch ;;
-sparc*)		 targ_archs=bfd_sparc_arch ;;
-strongarm*)	 targ_archs=bfd_arm_arch ;;
-thumb*)		 targ_archs=bfd_arm_arch ;;
-v850*)		 targ_archs=bfd_v850_arch ;;
-x86_64)		 targ_archs=bfd_i386_arch ;;
-xscale*)	 targ_archs=bfd_arm_arch ;;
-xtensa*)	 targ_archs=bfd_xtensa_arch ;;
-z8k*)		 targ_archs=bfd_z8k_arch ;;
-am33_2.0)	 targ_archs=bfd_mn10300_arch ;;
-*)		 targ_archs=bfd_${targ_cpu}_arch ;;
+pdp11*)	         targ_archs=bfd_pdp11_arch ;;
+pj*)	         targ_archs="bfd_pj_arch bfd_i386_arch";;
+powerpc*)        targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+rs6000)	         targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+s390*)           targ_archs=bfd_s390_arch ;;
+sh*)             targ_archs=bfd_sh_arch ;;
+sparc*)          targ_archs=bfd_sparc_arch ;;
+strongarm*)      targ_archs=bfd_arm_arch ;;
+thumb*)	         targ_archs=bfd_arm_arch ;;
+v850*)	         targ_archs=bfd_v850_arch ;;
+x86_64)          targ_archs=bfd_i386_arch ;;
+xscale*)         targ_archs=bfd_arm_arch ;;
+xtensa*)         targ_archs=bfd_xtensa_arch ;;
+z8k*)	         targ_archs=bfd_z8k_arch ;;
+am33_2.0)        targ_archs=bfd_mn10300_arch ;;
+*)	         targ_archs=bfd_${targ_cpu}_arch ;;
 esac
 
 
@@ -416,7 +416,7 @@
     ;;
 #endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
 
-  i370-*-*)
+  i370-*-*) 
     targ_defvec=bfd_elf32_i370_vec
     targ_selvecs="bfd_elf32_i370_vec"
     ;;
@@ -424,18 +424,12 @@
     targ_defvec=i386coff_vec
     targ_selvecs=bfd_elf32_i386_vec
     ;;
-  i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | \
+  i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \
   i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \
   i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=i386coff_vec
     ;;
-  i[3-7]86-*-solaris2*)
-    targ_defvec=bfd_elf32_i386_vec
-    targ_selvecs=i386coff_vec
-    targ64_selvecs=bfd_elf64_x86_64_vec
-    want64=true
-    ;;
   i[3-7]86-*-kaos*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=bfd_elf32_i386_vec
@@ -509,7 +503,7 @@
     targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
     targ_underscore=yes
     ;;
-  i[3-7]86-*-openbsd*)
+  i[3-7]86-*-openbsd*) 
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=i386netbsd_vec
     ;;
@@ -640,12 +634,12 @@
     targ_defvec=bfd_elf32_m32rlelin_vec
     targ_selvecs="bfd_elf32_m32rlin_vec  bfd_elf32_m32rlelin_vec"
     ;;
-
+                                                                                
   m32r*-*-linux*)
     targ_defvec=bfd_elf32_m32rlin_vec
     targ_selvecs="bfd_elf32_m32rlin_vec  bfd_elf32_m32rlelin_vec"
     ;;
-
+                                                                                
   m32r*le-*-*)
     targ_defvec=bfd_elf32_m32rle_vec
     targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec"
@@ -729,7 +723,7 @@
     targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
     targ_underscore=yes
     ;;
-  m68*-*-netbsdelf*)
+  m68*-*-netbsdelf*) 
     targ_defvec=bfd_elf32_m68k_vec
     targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
     ;;
@@ -965,7 +959,7 @@
     targ_defvec=rs6000coff_vec
     targ64_selvecs=rs6000coff64_vec
     case "${targ}" in
-	*-*-aix4.[3456789]* | *-*-aix[56789]*)
+        *-*-aix4.[3456789]* | *-*-aix[56789]*)
 	want64=true;;
 	*)
 	targ_cflags=-DSMALL_ARCHIVE;;
@@ -1010,7 +1004,7 @@
     targ_defvec=bfd_elf32_powerpc_vec
     targ_selvecs="rs6000coff_vec"
     targ_cflags=-DSMALL_ARCHIVE
-    ;;
+    ;;    
   powerpc-*-netware*)
     targ_defvec=bfd_elf32_powerpc_vec
     targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
@@ -1126,7 +1120,7 @@
     targ_defvec=bfd_elf32_shl_symbian_vec
     targ_selvecs="shlcoff_vec shlcoff_small_vec"
     targ_underscore=yes
-    ;;
+    ;;    
   shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
     targ_defvec=bfd_elf32_shl_vec
     targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
diff --git a/bfd/configure b/bfd/configure
index f249bb2..6710ec6 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -2834,7 +2834,7 @@
 
 # Define the identity of the package.
  PACKAGE=bfd
- VERSION=2.15.93
+ VERSION=2.15.92
 
 
 cat >>confdefs.h <<_ACEOF
diff --git a/bfd/configure.in b/bfd/configure.in
index cc8afcf..c5fe78e 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -8,7 +8,7 @@
 AC_CANONICAL_TARGET
 AC_ISC_POSIX
 
-AM_INIT_AUTOMAKE(bfd, 2.15.93)
+AM_INIT_AUTOMAKE(bfd, 2.15.92)
 
 dnl These must be called before AM_PROG_LIBTOOL, because it may want
 dnl to call AC_CHECK_PROG.
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index 895568d..272c719 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -1,5 +1,5 @@
 /* BFD support for the Intel 386 architecture.
-   Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004
+   Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -22,22 +22,6 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
-{
-  64, /* 64 bits in a word */
-  64, /* 64 bits in an address */
-  8,  /* 8 bits in a byte */
-  bfd_arch_i386,
-  bfd_mach_x86_64_intel_syntax,
-  "i386:intel",
-  "i386:x86-64:intel",
-  3,
-  FALSE,
-  bfd_default_compatible,
-  bfd_default_scan,
-  0
-};
-
 const bfd_arch_info_type bfd_i386_arch_intel_syntax =
 {
   32,	/* 32 bits in a word */
@@ -50,11 +34,25 @@
   3,
   TRUE,
   bfd_default_compatible,
-  bfd_default_scan,
-  &bfd_x86_64_arch_intel_syntax
+  bfd_default_scan ,
+  0,
 };
-
-const bfd_arch_info_type i8086_arch =
+const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
+{
+  64, /* 64 bits in a word */
+  64, /* 64 bits in an address */
+  8,  /* 8 bits in a byte */
+  bfd_arch_i386,
+  bfd_mach_x86_64_intel_syntax,
+  "i386:intel",
+  "i386:x86-64:intel",
+  3,
+  TRUE,
+  bfd_default_compatible,
+  bfd_default_scan ,
+  &bfd_i386_arch_intel_syntax,
+};
+static const bfd_arch_info_type i8086_arch =
 {
   32,	/* 32 bits in a word */
   32,	/* 32 bits in an address (well, not really) */
@@ -66,8 +64,8 @@
   3,
   FALSE,
   bfd_default_compatible,
-  bfd_default_scan,
-  &bfd_i386_arch_intel_syntax
+  bfd_default_scan ,
+  &bfd_x86_64_arch_intel_syntax,
 };
 
 const bfd_arch_info_type bfd_x86_64_arch =
@@ -80,10 +78,10 @@
   "i386",
   "i386:x86-64",
   3,
-  FALSE,
+  TRUE,
   bfd_default_compatible,
-  bfd_default_scan,
-  &i8086_arch
+  bfd_default_scan ,
+  &i8086_arch,
 };
 
 const bfd_arch_info_type bfd_i386_arch =
@@ -98,6 +96,6 @@
   3,
   TRUE,
   bfd_default_compatible,
-  bfd_default_scan,
+  bfd_default_scan ,
   &bfd_x86_64_arch
 };
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b1f4ea6..a092657 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1703,19 +1703,13 @@
      We keep a list of all the previously read compilation units, and
      a pointer to the next un-read compilation unit.  Check the
      previously read units before reading more.  */
-  struct dwarf2_debug *stash;
+  struct dwarf2_debug *stash = *pinfo;
 
   /* What address are we looking for?  */
-  bfd_vma addr;
+  bfd_vma addr = offset + section->vma;
 
   struct comp_unit* each;
 
-  stash = *pinfo;
-  addr = offset;
-  if (section->output_section)
-    addr += section->output_section->vma + section->output_offset;
-  else
-    addr += section->vma;
   *filename_ptr = NULL;
   *functionname_ptr = NULL;
   *linenumber_ptr = 0;
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index ff26613..8a1b6da 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -286,10 +286,9 @@
 
 struct eh_cie_fde
 {
-  /* For FDEs, this points to the CIE used.  */
-  struct eh_cie_fde *cie_inf;
-  unsigned int size;
   unsigned int offset;
+  unsigned int size;
+  asection *sec;
   unsigned int new_offset;
   unsigned char fde_encoding;
   unsigned char lsda_encoding;
@@ -298,8 +297,6 @@
   unsigned int removed : 1;
   unsigned int make_relative : 1;
   unsigned int make_lsda_relative : 1;
-  unsigned int need_relative : 1;
-  unsigned int need_lsda_relative : 1;
   unsigned int per_encoding_relative : 1;
 };
 
@@ -320,15 +317,14 @@
 {
   struct cie last_cie;
   asection *last_cie_sec;
-  struct eh_cie_fde *last_cie_inf;
   asection *hdr_sec;
+  unsigned int last_cie_offset;
   unsigned int fde_count, array_count;
   struct eh_frame_array_ent *array;
   /* TRUE if .eh_frame_hdr should contain the sorted search table.
      We build it if we successfully read all .eh_frame input sections
      and recognize them.  */
   bfd_boolean table;
-  bfd_boolean offsets_adjusted;
 };
 
 /* ELF linker hash table.  */
@@ -1260,7 +1256,7 @@
   unsigned int cverrefs;
 
   /* Segment flags for the PT_GNU_STACK segment.  */
-  unsigned int stack_flags;
+  unsigned int stack_flags;  
 
   /* Should the PT_GNU_RELRO segment be emitted?  */
   bfd_boolean relro;
@@ -1532,7 +1528,7 @@
 extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
   (bfd *, struct bfd_link_info *);
 extern bfd_vma _bfd_elf_eh_frame_section_offset
-  (bfd *, struct bfd_link_info *, asection *, bfd_vma);
+  (bfd *, asection *, bfd_vma);
 extern bfd_boolean _bfd_elf_write_section_eh_frame
   (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
 extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index c4cf46f..be4e307 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -213,14 +213,14 @@
 {
   bfd_byte *ehbuf = NULL, *buf;
   bfd_byte *last_cie, *last_fde;
-  struct eh_cie_fde *ent, *last_cie_inf, *this_inf;
   struct cie_header hdr;
   struct cie cie;
   struct elf_link_hash_table *htab;
   struct eh_frame_hdr_info *hdr_info;
   struct eh_frame_sec_info *sec_info = NULL;
   unsigned int leb128_tmp;
-  unsigned int cie_usage_count, offset;
+  unsigned int cie_usage_count, last_cie_ndx, i, offset;
+  unsigned int make_relative, make_lsda_relative;
   bfd_size_type new_size;
   unsigned int ptr_size;
 
@@ -234,7 +234,7 @@
        && bfd_is_abs_section (sec->output_section)))
     {
       /* At least one of the sections is being discarded from the
-	 link, so we should just ignore them.  */
+         link, so we should just ignore them.  */
       return FALSE;
     }
 
@@ -264,10 +264,12 @@
 	      == ELFCLASS64) ? 8 : 4;
   buf = ehbuf;
   last_cie = NULL;
-  last_cie_inf = NULL;
+  last_cie_ndx = 0;
   memset (&cie, 0, sizeof (cie));
   cie_usage_count = 0;
   new_size = sec->size;
+  make_relative = hdr_info->last_cie.make_relative;
+  make_lsda_relative = hdr_info->last_cie.make_lsda_relative;
   sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
 			  + 99 * sizeof (struct eh_cie_fde));
   if (sec_info == NULL)
@@ -284,14 +286,14 @@
 
 #define SKIP_RELOCS(buf)				\
   while (cookie->rel < cookie->relend			\
-	 && (cookie->rel->r_offset			\
+         && (cookie->rel->r_offset			\
 	     < (bfd_size_type) ((buf) - ehbuf)))	\
     cookie->rel++
 
 #define GET_RELOC(buf)					\
   ((cookie->rel < cookie->relend			\
     && (cookie->rel->r_offset				\
-	== (bfd_size_type) ((buf) - ehbuf)))		\
+        == (bfd_size_type) ((buf) - ehbuf)))		\
    ? cookie->rel : NULL)
 
   for (;;)
@@ -300,25 +302,18 @@
 
       if (sec_info->count == sec_info->alloced)
 	{
-	  struct eh_cie_fde *old_entry = sec_info->entry;
 	  sec_info = bfd_realloc (sec_info,
 				  sizeof (struct eh_frame_sec_info)
-				  + ((sec_info->alloced + 99)
-				     * sizeof (struct eh_cie_fde)));
+				  + (sec_info->alloced + 99)
+				     * sizeof (struct eh_cie_fde));
 	  if (sec_info == NULL)
 	    goto free_no_table;
 
 	  memset (&sec_info->entry[sec_info->alloced], 0,
 		  100 * sizeof (struct eh_cie_fde));
 	  sec_info->alloced += 100;
-
-	  /* Now fix any pointers into the array.  */
-	  if (last_cie_inf >= old_entry
-	      && last_cie_inf < old_entry + sec_info->count)
-	    last_cie_inf = sec_info->entry + (last_cie_inf - old_entry);
 	}
 
-      this_inf = sec_info->entry + sec_info->count;
       last_fde = buf;
       /* If we are at the end of the section, we still need to decide
 	 on whether to output or discard last encountered CIE (if any).  */
@@ -339,8 +334,8 @@
 	    /* CIE/FDE not contained fully in this .eh_frame input section.  */
 	    goto free_no_table;
 
-	  this_inf->offset = last_fde - ehbuf;
-	  this_inf->size = 4 + hdr.length;
+	  sec_info->entry[sec_info->count].offset = last_fde - ehbuf;
+	  sec_info->entry[sec_info->count].size = 4 + hdr.length;
 
 	  if (hdr.length == 0)
 	    {
@@ -381,15 +376,21 @@
 		  || cie_usage_count == 0)
 		{
 		  new_size -= cie.hdr.length + 4;
-		  last_cie_inf->removed = 1;
+		  sec_info->entry[last_cie_ndx].removed = 1;
+		  sec_info->entry[last_cie_ndx].sec = hdr_info->last_cie_sec;
+		  sec_info->entry[last_cie_ndx].new_offset
+		    = hdr_info->last_cie_offset;
 		}
 	      else
 		{
 		  hdr_info->last_cie = cie;
 		  hdr_info->last_cie_sec = sec;
-		  last_cie_inf->make_relative = cie.make_relative;
-		  last_cie_inf->make_lsda_relative = cie.make_lsda_relative;
-		  last_cie_inf->per_encoding_relative
+		  hdr_info->last_cie_offset = last_cie - ehbuf;
+		  sec_info->entry[last_cie_ndx].make_relative
+		    = cie.make_relative;
+		  sec_info->entry[last_cie_ndx].make_lsda_relative
+		    = cie.make_lsda_relative;
+		  sec_info->entry[last_cie_ndx].per_encoding_relative
 		    = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel;
 		}
 	    }
@@ -397,8 +398,8 @@
 	  if (hdr.id == (unsigned int) -1)
 	    break;
 
-	  last_cie_inf = this_inf;
-	  this_inf->cie = 1;
+	  last_cie_ndx = sec_info->count;
+	  sec_info->entry[sec_info->count].cie = 1;
 
 	  cie_usage_count = 0;
 	  memset (&cie, 0, sizeof (cie));
@@ -511,7 +512,7 @@
 
 	  /* For shared libraries, try to get rid of as many RELATIVE relocs
 	     as possible.  */
-	  if (info->shared
+          if (info->shared
 	      && (get_elf_backend_data (abfd)
 		  ->elf_backend_can_make_relative_eh_frame
 		  (abfd, info, sec))
@@ -551,13 +552,12 @@
 	  if (GET_RELOC (buf) == NULL)
 	    /* This should not happen.  */
 	    goto free_no_table;
-
 	  if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
 	    {
 	      /* This is a FDE against a discarded section.  It should
 		 be deleted.  */
 	      new_size -= hdr.length + 4;
-	      this_inf->removed = 1;
+	      sec_info->entry[sec_info->count].removed = 1;
 	    }
 	  else
 	    {
@@ -585,14 +585,14 @@
 		read_uleb128 (dummy, buf);
 	      /* If some new augmentation data is added before LSDA
 		 in FDE augmentation area, this need to be adjusted.  */
-	      this_inf->lsda_offset = (buf - aug);
+	      sec_info->entry[sec_info->count].lsda_offset = (buf - aug);
 	    }
 	  buf = last_fde + 4 + hdr.length;
 	  SKIP_RELOCS (buf);
 	}
 
-      this_inf->fde_encoding = cie.fde_encoding;
-      this_inf->lsda_encoding = cie.lsda_encoding;
+      sec_info->entry[sec_info->count].fde_encoding = cie.fde_encoding;
+      sec_info->entry[sec_info->count].lsda_encoding = cie.lsda_encoding;
       sec_info->count++;
     }
 
@@ -601,18 +601,41 @@
 
   /* Ok, now we can assign new offsets.  */
   offset = 0;
-  last_cie_inf = hdr_info->last_cie_inf;
-  for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
-    if (!ent->removed)
-      {
-	ent->new_offset = offset;
-	offset += ent->size;
-	if (ent->cie)
-	  last_cie_inf = ent;
-	else
-	  ent->cie_inf = last_cie_inf;
-      }
-  hdr_info->last_cie_inf = last_cie_inf;
+  last_cie_ndx = 0;
+  for (i = 0; i < sec_info->count; i++)
+    {
+      if (! sec_info->entry[i].removed)
+	{
+	  sec_info->entry[i].new_offset = offset;
+	  offset += sec_info->entry[i].size;
+	  if (sec_info->entry[i].cie)
+	    {
+	      last_cie_ndx = i;
+	      make_relative = sec_info->entry[i].make_relative;
+	      make_lsda_relative = sec_info->entry[i].make_lsda_relative;
+	    }
+	  else
+	    {
+	      sec_info->entry[i].make_relative = make_relative;
+	      sec_info->entry[i].make_lsda_relative = make_lsda_relative;
+	      sec_info->entry[i].per_encoding_relative = 0;
+	    }
+	}
+      else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec)
+	{
+	  /* Need to adjust new_offset too.  */
+	  BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
+		      == sec_info->entry[i].new_offset);
+	  sec_info->entry[i].new_offset
+	    = sec_info->entry[last_cie_ndx].new_offset;
+	}
+    }
+  if (hdr_info->last_cie_sec == sec)
+    {
+      BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
+		  == hdr_info->last_cie_offset);
+      hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset;
+    }
 
   /* Shrink the sec as needed.  */
   sec->rawsize = sec->size;
@@ -713,13 +736,10 @@
 
 bfd_vma
 _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
-				  struct bfd_link_info *info,
 				  asection *sec,
 				  bfd_vma offset)
 {
   struct eh_frame_sec_info *sec_info;
-  struct elf_link_hash_table *htab;
-  struct eh_frame_hdr_info *hdr_info;
   unsigned int lo, hi, mid;
 
   if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
@@ -729,11 +749,6 @@
   if (offset >= sec->rawsize)
     return offset - sec->rawsize + sec->size;
 
-  htab = elf_hash_table (info);
-  hdr_info = &htab->eh_info;
-  if (hdr_info->offsets_adjusted)
-    offset += sec->output_offset;
-
   lo = 0;
   hi = sec_info->count;
   mid = 0;
@@ -757,31 +772,19 @@
 
   /* If converting to DW_EH_PE_pcrel, there will be no need for run-time
      relocation against FDE's initial_location field.  */
-  if (!sec_info->entry[mid].cie
-      && sec_info->entry[mid].cie_inf->make_relative
-      && offset == sec_info->entry[mid].offset + 8
-      && (sec_info->entry[mid].cie_inf->need_relative
-	  || !hdr_info->offsets_adjusted))
-    {
-      sec_info->entry[mid].cie_inf->need_relative = 1;
-      return (bfd_vma) -2;
-    }
+  if (sec_info->entry[mid].make_relative
+      && ! sec_info->entry[mid].cie
+      && offset == sec_info->entry[mid].offset + 8)
+    return (bfd_vma) -2;
 
   /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need
      for run-time relocation against LSDA field.  */
-  if (!sec_info->entry[mid].cie
-      && sec_info->entry[mid].cie_inf->make_lsda_relative
+  if (sec_info->entry[mid].make_lsda_relative
+      && ! sec_info->entry[mid].cie
       && (offset == (sec_info->entry[mid].offset + 8
-		     + sec_info->entry[mid].lsda_offset))
-      && (sec_info->entry[mid].cie_inf->need_lsda_relative
-	  || !hdr_info->offsets_adjusted))
-    {
-      sec_info->entry[mid].cie_inf->need_lsda_relative = 1;
-      return (bfd_vma) -2;
-    }
+		     + sec_info->entry[mid].lsda_offset)))
+    return (bfd_vma) -2;
 
-  if (hdr_info->offsets_adjusted)
-    offset -= sec->output_offset;
   return (offset + sec_info->entry[mid].new_offset
 	  - sec_info->entry[mid].offset);
 }
@@ -798,10 +801,11 @@
   struct eh_frame_sec_info *sec_info;
   struct elf_link_hash_table *htab;
   struct eh_frame_hdr_info *hdr_info;
+  unsigned int i;
   bfd_byte *p, *buf;
   unsigned int leb128_tmp;
+  unsigned int cie_offset = 0;
   unsigned int ptr_size;
-  struct eh_cie_fde *ent;
 
   ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
 	      == ELFCLASS64) ? 8 : 4;
@@ -812,39 +816,6 @@
   sec_info = elf_section_data (sec)->sec_info;
   htab = elf_hash_table (info);
   hdr_info = &htab->eh_info;
-
-  /* First convert all offsets to output section offsets, so that a
-     CIE offset is valid if the CIE is used by a FDE from some other
-     section.  This can happen when duplicate CIEs are deleted in
-     _bfd_elf_discard_section_eh_frame.  We do all sections here because
-     this function might not be called on sections in the same order as
-     _bfd_elf_discard_section_eh_frame.  */
-  if (!hdr_info->offsets_adjusted)
-    {
-      bfd *ibfd;
-      asection *eh;
-      struct eh_frame_sec_info *eh_inf;
-
-      for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
-	{
-	  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
-	      || (ibfd->flags & DYNAMIC) != 0)
-	    continue;
-
-	  eh = bfd_get_section_by_name (ibfd, ".eh_frame");
-	  if (eh == NULL || eh->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
-	    continue;
-
-	  eh_inf = elf_section_data (eh)->sec_info;
-	  for (ent = eh_inf->entry; ent < eh_inf->entry + eh_inf->count; ++ent)
-	    {
-	      ent->offset += eh->output_offset;
-	      ent->new_offset += eh->output_offset;
-	    }
-	}
-      hdr_info->offsets_adjusted = TRUE;
-    }
-
   if (hdr_info->table && hdr_info->array == NULL)
     hdr_info->array
       = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
@@ -852,17 +823,36 @@
     hdr_info = NULL;
 
   p = contents;
-  for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
+  for (i = 0; i < sec_info->count; ++i)
     {
-      if (ent->removed)
-	continue;
+      if (sec_info->entry[i].removed)
+	{
+	  if (sec_info->entry[i].cie)
+	    {
+	      /* If CIE is removed due to no remaining FDEs referencing it
+		 and there were no CIEs kept before it, sec_info->entry[i].sec
+		 will be zero.  */
+	      if (sec_info->entry[i].sec == NULL)
+		cie_offset = 0;
+	      else
+		{
+		  cie_offset = sec_info->entry[i].new_offset;
+		  cie_offset += (sec_info->entry[i].sec->output_section->vma
+				 + sec_info->entry[i].sec->output_offset
+				 - sec->output_section->vma
+				 - sec->output_offset);
+		}
+	    }
+	  continue;
+	}
 
-      if (ent->cie)
+      if (sec_info->entry[i].cie)
 	{
 	  /* CIE */
-	  if (ent->need_relative
-	      || ent->need_lsda_relative
-	      || ent->per_encoding_relative)
+	  cie_offset = sec_info->entry[i].new_offset;
+	  if (sec_info->entry[i].make_relative
+	      || sec_info->entry[i].make_lsda_relative
+	      || sec_info->entry[i].per_encoding_relative)
 	    {
 	      unsigned char *aug;
 	      unsigned int action;
@@ -870,10 +860,10 @@
 
 	      /* Need to find 'R' or 'L' augmentation's argument and modify
 		 DW_EH_PE_* value.  */
-	      action = ((ent->need_relative ? 1 : 0)
-			| (ent->need_lsda_relative ? 2 : 0)
-			| (ent->per_encoding_relative ? 4 : 0));
-	      buf = contents + ent->offset - sec->output_offset;
+	      action = (sec_info->entry[i].make_relative ? 1 : 0)
+		       | (sec_info->entry[i].make_lsda_relative ? 2 : 0)
+		       | (sec_info->entry[i].per_encoding_relative ? 4 : 0);
+	      buf = contents + sec_info->entry[i].offset;
 	      /* Skip length, id and version.  */
 	      buf += 9;
 	      aug = buf;
@@ -893,7 +883,7 @@
 		  case 'L':
 		    if (action & 2)
 		      {
-			BFD_ASSERT (*buf == ent->lsda_encoding);
+			BFD_ASSERT (*buf == sec_info->entry[i].lsda_encoding);
 			*buf |= DW_EH_PE_pcrel;
 			action &= ~2;
 		      }
@@ -901,22 +891,25 @@
 		    break;
 		  case 'P':
 		    per_encoding = *buf++;
-		    per_width = get_DW_EH_PE_width (per_encoding, ptr_size);
+                    per_width = get_DW_EH_PE_width (per_encoding,
+						    ptr_size);
 		    BFD_ASSERT (per_width != 0);
 		    BFD_ASSERT (((per_encoding & 0x70) == DW_EH_PE_pcrel)
-				== ent->per_encoding_relative);
+				== sec_info->entry[i].per_encoding_relative);
 		    if ((per_encoding & 0xf0) == DW_EH_PE_aligned)
 		      buf = (contents
 			     + ((buf - contents + per_width - 1)
 				& ~((bfd_size_type) per_width - 1)));
 		    if (action & 4)
 		      {
-			bfd_vma val;
+			bfd_vma value;
 
-			val = read_value (abfd, buf, per_width,
-					  get_DW_EH_PE_signed (per_encoding));
-			val += ent->offset - ent->new_offset;
-			write_value (abfd, buf, val, per_width);
+			value = read_value (abfd, buf, per_width,
+					    get_DW_EH_PE_signed
+					    (per_encoding));
+			value += (sec_info->entry[i].offset
+				  - sec_info->entry[i].new_offset);
+			write_value (abfd, buf, value, per_width);
 			action &= ~4;
 		      }
 		    buf += per_width;
@@ -924,7 +917,7 @@
 		  case 'R':
 		    if (action & 1)
 		      {
-			BFD_ASSERT (*buf == ent->fde_encoding);
+			BFD_ASSERT (*buf == sec_info->entry[i].fde_encoding);
 			*buf |= DW_EH_PE_pcrel;
 			action &= ~1;
 		      }
@@ -935,25 +928,26 @@
 		  }
 	    }
 	}
-      else if (ent->size > 4)
+      else if (sec_info->entry[i].size > 4)
 	{
 	  /* FDE */
-	  bfd_vma value, address;
+	  bfd_vma value = 0, address;
 	  unsigned int width;
 
-	  buf = contents + ent->offset - sec->output_offset;
+	  buf = contents + sec_info->entry[i].offset;
 	  /* Skip length.  */
 	  buf += 4;
-	  value = ent->new_offset + 4 - ent->cie_inf->new_offset;
-	  bfd_put_32 (abfd, value, buf);
+	  bfd_put_32 (abfd,
+		      sec_info->entry[i].new_offset + 4 - cie_offset, buf);
 	  buf += 4;
-	  width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
-	  value = read_value (abfd, buf, width,
-			      get_DW_EH_PE_signed (ent->fde_encoding));
-	  address = value;
+	  width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding,
+				      ptr_size);
+	  address = value = read_value (abfd, buf, width,
+					get_DW_EH_PE_signed
+					(sec_info->entry[i].fde_encoding));
 	  if (value)
 	    {
-	      switch (ent->fde_encoding & 0xf0)
+	      switch (sec_info->entry[i].fde_encoding & 0xf0)
 		{
 		case DW_EH_PE_indirect:
 		case DW_EH_PE_textrel:
@@ -968,12 +962,15 @@
 		  }
 		  break;
 		case DW_EH_PE_pcrel:
-		  value += ent->offset - ent->new_offset;
-		  address += sec->output_section->vma + ent->offset + 8;
+		  value += (sec_info->entry[i].offset
+			    - sec_info->entry[i].new_offset);
+		  address += (sec->output_section->vma + sec->output_offset
+			      + sec_info->entry[i].offset + 8);
 		  break;
 		}
-	      if (ent->cie_inf->need_relative)
-		value -= sec->output_section->vma + ent->new_offset + 8;
+	      if (sec_info->entry[i].make_relative)
+		value -= (sec->output_section->vma + sec->output_offset
+			  + sec_info->entry[i].new_offset + 8);
 	      write_value (abfd, buf, value, width);
 	    }
 
@@ -981,34 +978,41 @@
 	    {
 	      hdr_info->array[hdr_info->array_count].initial_loc = address;
 	      hdr_info->array[hdr_info->array_count++].fde
-		= sec->output_section->vma + ent->new_offset;
+		= (sec->output_section->vma + sec->output_offset
+		   + sec_info->entry[i].new_offset);
 	    }
 
-	  if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel
-	      || ent->cie_inf->need_lsda_relative)
+	  if ((sec_info->entry[i].lsda_encoding & 0xf0) == DW_EH_PE_pcrel
+	      || sec_info->entry[i].make_lsda_relative)
 	    {
-	      buf += ent->lsda_offset;
-	      width = get_DW_EH_PE_width (ent->lsda_encoding, ptr_size);
+	      buf += sec_info->entry[i].lsda_offset;
+	      width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
+					  ptr_size);
 	      value = read_value (abfd, buf, width,
-				  get_DW_EH_PE_signed (ent->lsda_encoding));
+				  get_DW_EH_PE_signed
+				  (sec_info->entry[i].lsda_encoding));
 	      if (value)
 		{
-		  if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel)
-		    value += ent->offset - ent->new_offset;
-		  else if (ent->cie_inf->need_lsda_relative)
-		    value -= (sec->output_section->vma + ent->new_offset + 8
-			      + ent->lsda_offset);
+		  if ((sec_info->entry[i].lsda_encoding & 0xf0)
+		      == DW_EH_PE_pcrel)
+		    value += (sec_info->entry[i].offset
+			      - sec_info->entry[i].new_offset);
+		  else if (sec_info->entry[i].make_lsda_relative)
+		    value -= (sec->output_section->vma + sec->output_offset
+			      + sec_info->entry[i].new_offset + 8
+			      + sec_info->entry[i].lsda_offset);
 		  write_value (abfd, buf, value, width);
 		}
 	    }
 	}
       else
 	/* Terminating FDE must be at the end of .eh_frame section only.  */
-	BFD_ASSERT (ent == sec_info->entry + sec_info->count - 1);
+	BFD_ASSERT (i == sec_info->count - 1);
 
-      BFD_ASSERT (p == contents + ent->new_offset - sec->output_offset);
-      memmove (p, contents + ent->offset - sec->output_offset, ent->size);
-      p += ent->size;
+      BFD_ASSERT (p == contents + sec_info->entry[i].new_offset);
+      memmove (p, contents + sec_info->entry[i].offset,
+	       sec_info->entry[i].size);
+      p += sec_info->entry[i].size;
     }
 
     {
@@ -1022,22 +1026,22 @@
 	      <= sec->output_section->size))
 	{
 	  /* Find the last CIE/FDE.  */
-	  ent = sec_info->entry + sec_info->count;
-	  while (--ent != sec_info->entry)
-	    if (!ent->removed)
+	  for (i = sec_info->count - 1; i > 0; i--)
+	    if (! sec_info->entry[i].removed)
 	      break;
 
 	  /* The size of the last CIE/FDE must be at least 4.  */
-	  if (ent->removed || ent->size < 4)
+	  if (sec_info->entry[i].removed
+	      || sec_info->entry[i].size < 4)
 	    abort ();
 
 	  pad = alignment - pad;
 
-	  buf = contents + ent->new_offset - sec->output_offset;
+	  buf = contents + sec_info->entry[i].new_offset;
 
 	  /* Update length.  */
-	  ent->size += pad;
-	  bfd_put_32 (abfd, ent->size - 4, buf);
+	  sec_info->entry[i].size += pad;
+	  bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf);
 
 	  /* Pad it with DW_CFA_nop  */
 	  memset (p, 0, pad);
@@ -1050,8 +1054,8 @@
   BFD_ASSERT ((bfd_size_type) (p - contents) == sec->size);
 
   return bfd_set_section_contents (abfd, sec->output_section,
-				   contents, (file_ptr) sec->output_offset,
-				   sec->size);
+                                   contents, (file_ptr) sec->output_offset,
+                                   sec->size);
 }
 
 /* Helper function used to sort .eh_frame_hdr search table by increasing
diff --git a/bfd/elf.c b/bfd/elf.c
index b7674e3..c57da59 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1739,7 +1739,6 @@
     case SHT_INIT_ARRAY:	/* .init_array section.  */
     case SHT_FINI_ARRAY:	/* .fini_array section.  */
     case SHT_PREINIT_ARRAY:	/* .preinit_array section.  */
-    case SHT_GNU_LIBLIST:	/* .gnu.liblist section.  */
       return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
 
     case SHT_DYNAMIC:	/* Dynamic linking information.  */
@@ -2133,8 +2132,6 @@
   { ".rela",           5, -1, SHT_RELA,     0 },
   { ".rel",            4, -1, SHT_REL,      0 },
   { ".stabstr",        5,  3, SHT_STRTAB,   0 },
-  { ".gnu.liblist",   12,  0, SHT_GNU_LIBLIST, SHF_ALLOC },
-  { ".gnu.conflict",  13,  0, SHT_RELA,     SHF_ALLOC },
   { NULL,              0,  0, 0,            0 }
 };
 
@@ -2972,17 +2969,6 @@
 	    d->this_hdr.sh_link = elf_section_data (s)->this_idx;
 	  break;
 
-	case SHT_GNU_LIBLIST:
-	  /* sh_link is the section header index of the prelink library
-	     list 
-	     used for the dynamic entries, or the symbol table, or the
-	     version strings.  */
-	  s = bfd_get_section_by_name (abfd, (sec->flags & SEC_ALLOC)
-					     ? ".dynstr" : ".gnu.libstr");
-	  if (s != NULL)
-	    d->this_hdr.sh_link = elf_section_data (s)->this_idx;
-	  break;
-
 	case SHT_HASH:
 	case SHT_GNU_versym:
 	  /* sh_link is the section header index of the symbol table
@@ -3880,8 +3866,8 @@
   if (alloc != 0 && count > alloc)
     {
       ((*_bfd_error_handler)
-       (_("%B: Not enough room for program headers (allocated %u, need %u)"),
-	abfd, alloc, count));
+       (_("%s: Not enough room for program headers (allocated %u, need %u)"),
+	bfd_get_filename (abfd), alloc, count));
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -3920,63 +3906,32 @@
 	qsort (m->sections, (size_t) m->count, sizeof (asection *),
 	       elf_sort_sections);
 
-      /* An ELF segment (described by Elf_Internal_Phdr) may contain a
-	 number of sections with contents contributing to both p_filesz
-	 and p_memsz, followed by a number of sections with no contents
-	 that just contribute to p_memsz.  In this loop, OFF tracks next
-	 available file offset for PT_LOAD and PT_NOTE segments.  VOFF is
-	 an adjustment we use for segments that have no file contents
-	 but need zero filled memory allocation.  */
-      voff = 0;
       p->p_type = m->p_type;
       p->p_flags = m->p_flags;
 
       if (p->p_type == PT_LOAD
-	  && m->count > 0)
+	  && m->count > 0
+	  && (m->sections[0]->flags & SEC_ALLOC) != 0)
 	{
-	  bfd_size_type align;
-	  bfd_vma adjust;
-
 	  if ((abfd->flags & D_PAGED) != 0)
-	    align = bed->maxpagesize;
+	    off += vma_page_aligned_bias (m->sections[0]->vma, off,
+					  bed->maxpagesize);
 	  else
 	    {
-	      unsigned int align_power = 0;
+	      bfd_size_type align;
+
+	      align = 0;
 	      for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
 		{
-		  unsigned int secalign;
+		  bfd_size_type secalign;
 
 		  secalign = bfd_get_section_alignment (abfd, *secpp);
-		  if (secalign > align_power)
-		    align_power = secalign;
+		  if (secalign > align)
+		    align = secalign;
 		}
-	      align = (bfd_size_type) 1 << align_power;
-	    }
 
-	  adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align);
-	  off += adjust;
-	  if (adjust != 0
-	      && !m->includes_filehdr
-	      && !m->includes_phdrs
-	      && (ufile_ptr) off >= align)
-	    {
-	      /* If the first section isn't loadable, the same holds for
-		 any other sections.  Since the segment won't need file
-		 space, we can make p_offset overlap some prior segment.
-		 However, .tbss is special.  If a segment starts with
-		 .tbss, we need to look at the next section to decide
-		 whether the segment has any loadable sections.  */
-	      i = 0;
-	      while ((m->sections[i]->flags & SEC_LOAD) == 0)
-		{
-		  if ((m->sections[i]->flags & SEC_THREAD_LOCAL) == 0
-		      || ++i >= m->count)
-		    {
-		      off -= adjust;
-		      voff = adjust - align;
-		      break;
-		    }
-		}
+	      off += vma_page_aligned_bias (m->sections[0]->vma, off,
+					    1 << align);
 	    }
 	}
       /* Make sure the .dynamic section is the first section in the
@@ -3986,8 +3941,8 @@
 	       && strcmp (m->sections[0]->name, ".dynamic") != 0)
 	{
 	  _bfd_error_handler
-	    (_("%B: The first section in the PT_DYNAMIC segment is not the .dynamic section"),
-	     abfd);
+	    (_("%s: The first section in the PT_DYNAMIC segment is not the .dynamic section"),
+	     bfd_get_filename (abfd));
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -4030,8 +3985,8 @@
 	      if (p->p_vaddr < (bfd_vma) off)
 		{
 		  (*_bfd_error_handler)
-		    (_("%B: Not enough room for program headers, try linking with -N"),
-		     abfd);
+		    (_("%s: Not enough room for program headers, try linking with -N"),
+		     bfd_get_filename (abfd));
 		  bfd_set_error (bfd_error_bad_value);
 		  return FALSE;
 		}
@@ -4089,7 +4044,7 @@
 	  || (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core))
 	{
 	  if (! m->includes_filehdr && ! m->includes_phdrs)
-	    p->p_offset = off + voff;
+	    p->p_offset = off;
 	  else
 	    {
 	      file_ptr adjust;
@@ -4100,6 +4055,8 @@
 	    }
 	}
 
+      voff = off;
+
       for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
 	{
 	  asection *sec;
@@ -4110,97 +4067,117 @@
 	  flags = sec->flags;
 	  align = 1 << bfd_get_section_alignment (abfd, sec);
 
-	  if (p->p_type == PT_LOAD
-	      || p->p_type == PT_TLS)
+	  /* The section may have artificial alignment forced by a
+	     link script.  Notice this case by the gap between the
+	     cumulative phdr lma and the section's lma.  */
+	  if (p->p_paddr + p->p_memsz < sec->lma)
+	    {
+	      bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
+
+	      p->p_memsz += adjust;
+	      if (p->p_type == PT_LOAD
+		  || (p->p_type == PT_NOTE
+		      && bfd_get_format (abfd) == bfd_core))
+		{
+		  off += adjust;
+		  voff += adjust;
+		}
+	      if ((flags & SEC_LOAD) != 0
+		  || (flags & SEC_THREAD_LOCAL) != 0)
+		p->p_filesz += adjust;
+	    }
+
+	  if (p->p_type == PT_LOAD)
 	    {
 	      bfd_signed_vma adjust;
 
 	      if ((flags & SEC_LOAD) != 0)
 		{
-		  adjust = sec->lma - (p->p_paddr + p->p_filesz);
+		  adjust = sec->lma - (p->p_paddr + p->p_memsz);
 		  if (adjust < 0)
-		    {
-		      (*_bfd_error_handler)
-			(_("%B: section %A lma 0x%lx overlaps previous sections"),
-			 abfd, sec, (unsigned long) sec->lma);
-		      adjust = 0;
-		    }
-		  off += adjust;
-		  p->p_filesz += adjust;
-		  p->p_memsz += adjust;
+		    adjust = 0;
 		}
-	      /* .tbss is special.  It doesn't contribute to p_memsz of
-		 normal segments.  */
-	      else if ((flags & SEC_THREAD_LOCAL) == 0
-		       || p->p_type == PT_TLS)
+	      else if ((flags & SEC_ALLOC) != 0)
 		{
 		  /* The section VMA must equal the file position
-		     modulo the page size.  */
-		  bfd_size_type page = align;
+		     modulo the page size.  FIXME: I'm not sure if
+		     this adjustment is really necessary.  We used to
+		     not have the SEC_LOAD case just above, and then
+		     this was necessary, but now I'm not sure.  */
 		  if ((abfd->flags & D_PAGED) != 0)
-		    page = bed->maxpagesize;
-		  adjust = vma_page_aligned_bias (sec->vma,
-						  p->p_vaddr + p->p_memsz,
-						  page);
-		  p->p_memsz += adjust;
+		    adjust = vma_page_aligned_bias (sec->vma, voff,
+						    bed->maxpagesize);
+		  else
+		    adjust = vma_page_aligned_bias (sec->vma, voff,
+						    align);
 		}
+	      else
+		adjust = 0;
+
+	      if (adjust != 0)
+		{
+		  if (i == 0)
+		    {
+		      (* _bfd_error_handler) (_("\
+Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x"),
+					      bfd_section_name (abfd, sec),
+					      sec->lma,
+					      p->p_paddr);
+		      return FALSE;
+		    }
+		  p->p_memsz += adjust;
+		  off += adjust;
+		  voff += adjust;
+		  if ((flags & SEC_LOAD) != 0)
+		    p->p_filesz += adjust;
+		}
+
+	      sec->filepos = off;
+
+	      /* We check SEC_HAS_CONTENTS here because if NOLOAD is
+                 used in a linker script we may have a section with
+                 SEC_LOAD clear but which is supposed to have
+                 contents.  */
+	      if ((flags & SEC_LOAD) != 0
+		  || (flags & SEC_HAS_CONTENTS) != 0)
+		off += sec->size;
+
+	      if ((flags & SEC_ALLOC) != 0
+		  && ((flags & SEC_LOAD) != 0
+		      || (flags & SEC_THREAD_LOCAL) == 0))
+		voff += sec->size;
 	    }
 
 	  if (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)
 	    {
-	      /* The section at i == 0 is the one that actually contains
-		 everything.  */
+	      /* The actual "note" segment has i == 0.
+		 This is the one that actually contains everything.  */
 	      if (i == 0)
 		{
 		  sec->filepos = off;
-		  off += sec->size;
 		  p->p_filesz = sec->size;
-		  p->p_memsz = 0;
-		  p->p_align = 1;
+		  off += sec->size;
+		  voff = off;
 		}
 	      else
 		{
-		  /* The rest are fake sections that shouldn't be written.  */
+		  /* Fake sections -- don't need to be written.  */
 		  sec->filepos = 0;
 		  sec->size = 0;
-		  sec->flags = 0;
-		  continue;
+		  flags = sec->flags = 0;
 		}
+	      p->p_memsz = 0;
+	      p->p_align = 1;
 	    }
 	  else
 	    {
-	      if (p->p_type == PT_LOAD)
-		{
-		  sec->filepos = off;
-		  /* FIXME: The SEC_HAS_CONTENTS test here dates back to
-		     1997, and the exact reason for it isn't clear.  One
-		     plausible explanation is that it is to work around
-		     a problem we have with linker scripts using data
-		     statements in NOLOAD sections.  I don't think it
-		     makes a great deal of sense to have such a section
-		     assigned to a PT_LOAD segment, but apparently
-		     people do this.  The data statement results in a
-		     bfd_data_link_order being built, and these need
-		     section contents to write into.  Eventually, we get
-		     to _bfd_elf_write_object_contents which writes any
-		     section with contents to the output.  Make room
-		     here for the write, so that following segments are
-		     not trashed.  */
-		  if ((flags & SEC_LOAD) != 0
-		      || (flags & SEC_HAS_CONTENTS) != 0)
-		    off += sec->size;
-		}
+	      if ((sec->flags & SEC_LOAD) != 0
+		  || (sec->flags & SEC_THREAD_LOCAL) == 0
+		  || p->p_type == PT_TLS)
+	      p->p_memsz += sec->size;
 
 	      if ((flags & SEC_LOAD) != 0)
-		{
-		  p->p_filesz += sec->size;
-		  p->p_memsz += sec->size;
-		}
-	      /* .tbss is special.  It doesn't contribute to p_memsz of
-		 normal segments.  */
-	      else if ((flags & SEC_THREAD_LOCAL) == 0
-		       || p->p_type == PT_TLS)
-		p->p_memsz += sec->size;
+		p->p_filesz += sec->size;
 
 	      if (p->p_type == PT_TLS
 		  && sec->size == 0
@@ -4516,8 +4493,8 @@
 	  else if ((hdr->sh_flags & SHF_ALLOC) != 0)
 	    {
 	      ((*_bfd_error_handler)
-	       (_("%B: warning: allocated section `%s' not in segment"),
-		abfd,
+	       (_("%s: warning: allocated section `%s' not in segment"),
+		bfd_get_filename (abfd),
 		(hdr->bfd_section == NULL
 		 ? "*unknown*"
 		 : hdr->bfd_section->name)));
@@ -6318,6 +6295,9 @@
 
       q = (elf_symbol_type *) *p;
 
+      if (bfd_get_section (&q->symbol) != section)
+	continue;
+
       switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
 	{
 	default:
@@ -6327,7 +6307,7 @@
 	  break;
 	case STT_NOTYPE:
 	case STT_FUNC:
-	  if (bfd_get_section (&q->symbol) == section
+	  if (q->symbol.section == section
 	      && q->symbol.value >= low_func
 	      && q->symbol.value <= offset)
 	    {
@@ -7746,7 +7726,7 @@
 
 bfd_vma
 _bfd_elf_section_offset (bfd *abfd,
-			 struct bfd_link_info *info,
+			 struct bfd_link_info *info ATTRIBUTE_UNUSED,
 			 asection *sec,
 			 bfd_vma offset)
 {
@@ -7756,7 +7736,7 @@
       return _bfd_stab_section_offset (sec, elf_section_data (sec)->sec_info,
 				       offset);
     case ELF_INFO_TYPE_EH_FRAME:
-      return _bfd_elf_eh_frame_section_offset (abfd, info, sec, offset);
+      return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
     default:
       return offset;
     }
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 88636d2..27e74d9 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -25,9 +25,9 @@
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
-/* In lieu of proper flags, assume all EABIv4 objects are interworkable.  */
+/* In leiu of proper flags, assume all EABIv3 objects are interworkable.  */
 #define INTERWORK_FLAG(abfd)  \
-  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER4 \
+  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER3 \
   || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK))
 
 /* The linker script knows the section names for placement.
@@ -925,8 +925,6 @@
   globals->target1_is_rel = target1_is_rel;
   if (strcmp (target2_type, "rel") == 0)
     globals->target2_reloc = R_ARM_REL32;
-  else if (strcmp (target2_type, "abs") == 0)
-    globals->target2_reloc = R_ARM_ABS32;
   else if (strcmp (target2_type, "got-rel") == 0)
     globals->target2_reloc = R_ARM_GOT_PREL;
   else
@@ -2328,7 +2326,6 @@
 }
 
 /* Function to keep ARM specific flags in the ELF header.  */
-
 static bfd_boolean
 elf32_arm_set_private_flags (bfd *abfd, flagword flags)
 {
@@ -2504,7 +2501,7 @@
   if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
     {
       _bfd_error_handler
-	(_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"),
+	(_("ERROR: %B is compiled for EABI version %d, whereas %B is compiled for version %d"),
 	 ibfd, obfd,
 	 (in_flags & EF_ARM_EABIMASK) >> 24,
 	 (out_flags & EF_ARM_EABIMASK) >> 24);
@@ -2705,10 +2702,6 @@
 
     case EF_ARM_EABI_VER3:
       fprintf (file, _(" [Version3 EABI]"));
-      break;
-
-    case EF_ARM_EABI_VER4:
-      fprintf (file, _(" [Version4 EABI]"));
 
       if (flags & EF_ARM_BE8)
 	fprintf (file, _(" [BE8]"));
@@ -3168,14 +3161,6 @@
     && (name[2] == 0);
 }
 
-/* Treat mapping symbols as special target symbols.  */
-
-static bfd_boolean
-elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
-{
-  return is_arm_mapping_symbol_name (sym->name);
-}
-
 /* This is a copy of elf_find_function() from elf.c except that
    ARM mapping symbols are ignored when looking for function names
    and STT_ARM_TFUNC is considered to a function type.  */
@@ -3199,6 +3184,9 @@
 
       q = (elf_symbol_type *) *p;
 
+      if (bfd_get_section (&q->symbol) != section)
+	continue;
+
       switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
 	{
 	default:
@@ -3214,7 +3202,7 @@
 	    continue;
 	  /* Fall through.  */
 	case STT_NOTYPE:
-	  if (bfd_get_section (&q->symbol) == section
+	  if (q->symbol.section == section
 	      && q->symbol.value >= low_func
 	      && q->symbol.value <= offset)
 	    {
@@ -3853,8 +3841,7 @@
 			splt->contents + h->plt.offset + 4 * i);
 	  
 	  /* Fill in the entry in the .rel.plt section.  */
-	  rel.r_offset = (splt->output_section->vma
-			  + splt->output_offset
+	  rel.r_offset = (splt->output_offset
 			  + h->plt.offset + 4 * (i - 1));
 	  rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
 	}
@@ -4047,16 +4034,7 @@
 	    case DT_SYMTAB:
 	      name = ".dynsym";
 	      goto get_vma_if_bpabi;
-	    case DT_VERSYM:
-	      name = ".gnu.version";
-	      goto get_vma_if_bpabi;
-	    case DT_VERDEF:
-	      name = ".gnu.version_d";
-	      goto get_vma_if_bpabi;
-	    case DT_VERNEED:
-	      name = ".gnu.version_r";
-	      goto get_vma_if_bpabi;
-
+	      
 	    case DT_PLTGOT:
 	      name = ".got";
 	      goto get_vma;
@@ -4255,6 +4233,9 @@
     }
 }
 
+static bfd_boolean elf32_arm_section_flags           (flagword *, const Elf_Internal_Shdr *);
+static void        elf32_arm_final_write_processing  (bfd *, bfd_boolean);
+
 /* Set the right machine number for an Arm ELF file.  */
 
 static bfd_boolean
@@ -4272,65 +4253,6 @@
   bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
 }
 
-/* Return TRUE if this is an unwinding table entry.  */
-
-static bfd_boolean
-is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
-{
-  size_t len1, len2;
-
-  len1 = sizeof (ELF_STRING_ARM_unwind) - 1;
-  len2 = sizeof (ELF_STRING_ARM_unwind_once) - 1;
-  return (strncmp (name, ELF_STRING_ARM_unwind, len1) == 0
-	  || strncmp (name, ELF_STRING_ARM_unwind_once, len2) == 0);
-}
-
-
-/* Set the type and flags for an ARM section.  We do this by
-   the section name, which is a hack, but ought to work.  */
-
-static bfd_boolean
-elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec)
-{
-  const char * name;
-
-  name = bfd_get_section_name (abfd, sec);
-
-  if (is_arm_elf_unwind_section_name (abfd, name))
-    {
-      hdr->sh_type = SHT_ARM_EXIDX;
-      hdr->sh_flags |= SHF_LINK_ORDER;
-    }
-  return TRUE;
-}
-
-/* Handle an ARM specific section when reading an object file.
-   This is called when elf.c finds a section with an unknown type.  */
-
-static bfd_boolean
-elf32_arm_section_from_shdr (bfd *abfd,
-			     Elf_Internal_Shdr * hdr,
-			     const char *name)
-{
-  /* There ought to be a place to keep ELF backend specific flags, but
-     at the moment there isn't one.  We just keep track of the
-     sections by their name, instead.  Fortunately, the ABI gives
-     names for all the ARM specific sections, so we will probably get
-     away with this.  */
-  switch (hdr->sh_type)
-    {
-    case SHT_ARM_EXIDX:
-      break;
-
-    default:
-      return FALSE;
-    }
-
-  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
-    return FALSE;
-
-  return TRUE;
-}
 
 /* Called for each symbol.  Builds a section map based on mapping symbols.
    Does not alter any of the symbols.  */
@@ -4485,7 +4407,6 @@
 #define bfd_elf32_bfd_reloc_type_lookup		elf32_arm_reloc_type_lookup
 #define bfd_elf32_find_nearest_line	        elf32_arm_find_nearest_line
 #define bfd_elf32_new_section_hook		elf32_arm_new_section_hook
-#define bfd_elf32_bfd_is_target_special_symbol	elf32_arm_is_target_special_symbol
 
 #define elf_backend_get_symbol_type             elf32_arm_get_symbol_type
 #define elf_backend_gc_mark_hook                elf32_arm_gc_mark_hook
@@ -4503,8 +4424,6 @@
 #define elf_backend_reloc_type_class		elf32_arm_reloc_type_class
 #define elf_backend_object_p			elf32_arm_object_p
 #define elf_backend_section_flags		elf32_arm_section_flags
-#define elf_backend_fake_sections  		elf32_arm_fake_sections
-#define elf_backend_section_from_shdr  		elf32_arm_section_from_shdr
 #define elf_backend_final_write_processing      elf32_arm_final_write_processing
 #define elf_backend_copy_indirect_symbol        elf32_arm_copy_indirect_symbol
 
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index f0c88dc..2e8a6b3 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -2960,7 +2960,7 @@
 {
   FILE *file = (FILE *) ptr;
 
-  BFD_ASSERT (abfd != NULL && ptr != NULL);
+  BFD_ASSERT (abfd != NULL && ptr != NULL)
 
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 53deac7..d95fa80 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -832,7 +832,7 @@
 
 /* Obtain the address of the entry in HT associated with the SYMNDXth
    local symbol of the input bfd ABFD, plus the addend, creating a new
-   entry if none existed.  */
+   entry if none existed.  */  
 inline static struct frvfdpic_relocs_info *
 frvfdpic_relocs_info_for_local (struct htab *ht,
 				bfd *abfd,
@@ -1021,7 +1021,7 @@
 				       asection *sec,
 				       Elf_Internal_Sym *sym,
 				       bfd_vma addend)
-
+				  
 {
   bfd_vma fd_lazy_rel_offset = (bfd_vma)-1;
   int dynindx = -1;
@@ -1099,7 +1099,7 @@
 				 ->output_section->vma
 				 + frvfdpic_got_section (info)->output_offset,
 				 R_FRV_32, idx, ad, entry);
-
+	
       bfd_put_32 (output_bfd, ad,
 		  frvfdpic_got_section (info)->contents
 		  + frvfdpic_got_initial_offset (info)
@@ -1112,7 +1112,7 @@
     {
       int reloc, idx;
       bfd_vma ad = 0;
-
+      
       if (! (entry->symndx == -1
 	     && entry->d.h->root.type == bfd_link_hash_undefweak
 	     && FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
@@ -1285,7 +1285,7 @@
 	{
 	  if (ad)
 	    return FALSE;
-
+	  
 	  fd_lazy_rel_offset = ofst;
 
 	  /* A function descriptor used for lazy or local resolving is
@@ -1297,7 +1297,7 @@
 	  lowword = entry->lzplt_entry + 4
 	    + frvfdpic_plt_section (info)->output_offset
 	    + frvfdpic_plt_section (info)->output_section->vma;
-	  highword = _frvfdpic_osec_to_segment
+	  highword = _frvfdpic_osec_to_segment 
 	    (output_bfd, frvfdpic_plt_section (info)->output_section);
 	}
       else
@@ -2095,14 +2095,14 @@
 	  relocation = picrel->got_entry;
 	  check_segment[0] = check_segment[1] = got_segment;
 	  break;
-
+	  
 	case R_FRV_FUNCDESC_GOT12:
 	case R_FRV_FUNCDESC_GOTHI:
 	case R_FRV_FUNCDESC_GOTLO:
 	  relocation = picrel->fdgot_entry;
 	  check_segment[0] = check_segment[1] = got_segment;
 	  break;
-
+	  
 	case R_FRV_GOTOFFHI:
 	case R_FRV_GOTOFF12:
 	case R_FRV_GOTOFFLO:
@@ -2479,7 +2479,7 @@
 	  if (! IS_FDPIC (output_bfd) || ! picrel->plt)
 	    break;
 	  /* Fall through.  */
-
+	  
 	  /* When referencing a GOT entry, a function descriptor or a
 	     PLT, we don't want the addend to apply to the reference,
 	     but rather to the referenced symbol.  The actual entry
@@ -2497,7 +2497,7 @@
 	  /* Note that we only want GOTOFFHI, not GOTOFFLO or GOTOFF12
 	     here, since we do want to apply the addend to the others.
 	     Note that we've applied the addend to GOTOFFHI before we
-	     shifted it right.  */
+	     shifted it right.  */ 
 	case R_FRV_GOTOFFHI:
 	  relocation -= rel->r_addend;
 	  break;
@@ -3147,7 +3147,7 @@
       odd = cur + got;
       got += 4;
     }
-
+  
   /* Compute the tentative boundaries of this range.  */
   gad->max = cur + got;
   gad->min = fdcur - fd;
@@ -3222,7 +3222,7 @@
 _frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad)
 {
   bfd_signed_vma ret;
-
+  
   if (gad->odd)
     {
       /* If there was an odd word left behind, use it.  */
@@ -3301,7 +3301,7 @@
     }
   else if (entry->privfd)
     entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo);
-
+  
   return 1;
 }
 
@@ -3331,7 +3331,7 @@
 	}
       else
 	{
-	  BFD_ASSERT (dinfo->gothilo.fdplt);
+	  BFD_ASSERT (dinfo->gothilo.fdplt)
 	  entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo);
 	  dinfo->gothilo.fdplt -= 8;
 	}
@@ -3370,9 +3370,9 @@
 	  == FRVFDPIC_LZPLT_RESOLV_LOC)
 	dinfo->g.lzplt += 4;
     }
-
+      
   return 1;
-}
+}  
 
 /* Follow indirect and warning hash entries so that each got entry
    points to the final symbol definition.  P must point to a pointer
@@ -3540,7 +3540,7 @@
       if (frvfdpic_got_section (info)->contents == NULL)
 	return FALSE;
     }
-
+  
   if (elf_hash_table (info)->dynamic_sections_created)
     /* Subtract the number of lzplt entries, since those will generate
        relocations in the pltrel section.  */
@@ -3571,7 +3571,7 @@
       if (frvfdpic_gotfixup_section (info)->contents == NULL)
 	return FALSE;
     }
-
+  
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       frvfdpic_pltrel_section (info)->size =
@@ -3587,7 +3587,7 @@
 	    return FALSE;
 	}
     }
-
+  
   /* Add 4 bytes for every block of at most 65535 lazy PLT entries,
      such that there's room for the additional instruction needed to
      call the resolver.  Since _frvfdpic_assign_got_entries didn't
@@ -4145,14 +4145,14 @@
 	  picrel = NULL;
 	  break;
 	}
-
+      
       switch (ELF32_R_TYPE (rel->r_info))
         {
 	case R_FRV_LABEL24:
 	  if (IS_FDPIC (abfd))
 	    picrel->call = 1;
 	  break;
-
+		
 	case R_FRV_FUNCDESC_VALUE:
 	  picrel->relocsfdv++;
 	  if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
@@ -4167,11 +4167,11 @@
 	  if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
 	    picrel->relocs32++;
 	  break;
-
+	    
 	case R_FRV_GOT12:
 	  picrel->got12 = 1;
 	  break;
-
+	    
 	case R_FRV_GOTHI:
 	case R_FRV_GOTLO:
 	  picrel->gothilo = 1;
@@ -4180,32 +4180,32 @@
 	case R_FRV_FUNCDESC_GOT12:
 	  picrel->fdgot12 = 1;
 	  break;
-
+	    
 	case R_FRV_FUNCDESC_GOTHI:
 	case R_FRV_FUNCDESC_GOTLO:
 	  picrel->fdgothilo = 1;
 	  break;
-
+	    
 	case R_FRV_GOTOFF12:
 	case R_FRV_GOTOFFHI:
 	case R_FRV_GOTOFFLO:
 	  picrel->gotoff = 1;
 	  break;
-
+	    
 	case R_FRV_FUNCDESC_GOTOFF12:
 	  picrel->fdgoff12 = 1;
 	  break;
-
+	    
 	case R_FRV_FUNCDESC_GOTOFFHI:
 	case R_FRV_FUNCDESC_GOTOFFLO:
 	  picrel->fdgoffhilo = 1;
 	  break;
-
+	    
 	case R_FRV_FUNCDESC:
 	  picrel->fd = 1;
 	  picrel->relocsfd++;
 	  break;
-
+	  
         /* This relocation describes the C++ object vtable hierarchy.
            Reconstruct it for later use during GC.  */
         case R_FRV_GNU_VTINHERIT:
@@ -4723,7 +4723,7 @@
 
   if (flags & EF_FRV_FDPIC)
     fprintf (file, " -mfdpic");
-
+  
   if (flags & EF_FRV_NON_PIC_RELOCS)
     fprintf (file, " non-pic relocations");
 
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index fd259cd..ec967e2 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1350,7 +1350,7 @@
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (dst->r_info);
-  BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY);
+  BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY)
   cache_ptr->howto = &m32r_elf_howto_table[r_type];
 }
 
@@ -2828,7 +2828,7 @@
             case R_M32R_GOTOFF:
               /* Relocation is relative to the start of the global offset
                  table (for ld24 rx, #uimm24). eg access at label+addend
-
+		 
                  ld24 rx. #label@GOTOFF + addend
                  sub  rx, r12.  */
 
@@ -4271,7 +4271,7 @@
 {
   FILE * file = (FILE *) ptr;
 
-  BFD_ASSERT (abfd != NULL && ptr != NULL);
+  BFD_ASSERT (abfd != NULL && ptr != NULL)
 
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index edc4efc..50cb3a4 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2759,6 +2759,15 @@
 
   return ret;
 }
+
+/* Modify the segment map if needed.  */
+
+static bfd_boolean
+ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
+			    struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+  return TRUE;
+}
 
 /* The powerpc .got has a blrl instruction in it.  Mark it executable.  */
 
@@ -5473,7 +5482,7 @@
 	  BFD_ASSERT (sec != NULL);
 	  BFD_ASSERT (bfd_is_und_section (sec)
 		      || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
-		      || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0);
+		      || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
 
 	    addend -= sec->output_section->vma + sec->output_offset + 0x8000;
 	  break;
@@ -6214,6 +6223,7 @@
 #define elf_backend_finish_dynamic_sections	ppc_elf_finish_dynamic_sections
 #define elf_backend_fake_sections		ppc_elf_fake_sections
 #define elf_backend_additional_program_headers	ppc_elf_additional_program_headers
+#define elf_backend_modify_segment_map		ppc_elf_modify_segment_map
 #define elf_backend_grok_prstatus		ppc_elf_grok_prstatus
 #define elf_backend_grok_psinfo			ppc_elf_grok_psinfo
 #define elf_backend_reloc_type_class		ppc_elf_reloc_type_class
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index c44a50a..77b1086 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -3371,8 +3371,6 @@
   switch (bfd_get_mach (abfd))
     {
     case bfd_mach_sparc :
-    case bfd_mach_sparc_sparclet :
-    case bfd_mach_sparc_sparclite :
       break; /* nothing to do */
     case bfd_mach_sparc_v8plus :
       elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
@@ -3391,6 +3389,7 @@
 				       | EF_SPARC_SUN_US3;
       break;
     case bfd_mach_sparc_sparclite_le :
+      elf_elfheader (abfd)->e_machine = EM_SPARC;
       elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
       break;
     default :
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index 8c96348..e03cc77 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -840,6 +840,10 @@
 	  sym = local_syms + r_symndx;
 	  sec = local_sections [r_symndx];
 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+	  name = bfd_elf_string_from_elf_section
+	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
+	  name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
 	}
       else
 	{
@@ -851,16 +855,6 @@
 				   unresolved_reloc, warned);
 	}
 
-      if (h != NULL)
-	name = h->root.root.string;
-      else
-	{
-	  name = (bfd_elf_string_from_elf_section
-		  (input_bfd, symtab_hdr->sh_link, sym->st_name));
-	  if (name == NULL || *name == '\0')
-	    name = bfd_section_name (input_bfd, sec);
-	}
-
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	case R_XSTORMY16_24:
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 8d9649e..0755e09 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -35,104 +35,192 @@
 #include "xtensa-isa.h"
 #include "xtensa-config.h"
 
-#define XTENSA_NO_NOP_REMOVAL 0
+/* Main interface functions.  */
+static void elf_xtensa_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static reloc_howto_type *elf_xtensa_reloc_type_lookup
+  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+extern int xtensa_read_table_entries
+  PARAMS ((bfd *, asection *, property_table_entry **, const char *));
+static bfd_boolean elf_xtensa_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+static void elf_xtensa_hide_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
+static asection *elf_xtensa_gc_mark_hook
+  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static bfd_boolean elf_xtensa_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+static bfd_boolean elf_xtensa_create_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_adjust_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static bfd_boolean elf_xtensa_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_modify_segment_map
+  PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static bfd_boolean elf_xtensa_relax_section
+  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *again));
+static bfd_boolean elf_xtensa_finish_dynamic_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+	   Elf_Internal_Sym *));
+static bfd_boolean elf_xtensa_finish_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_merge_private_bfd_data
+  PARAMS ((bfd *, bfd *));
+static bfd_boolean elf_xtensa_set_private_flags
+  PARAMS ((bfd *, flagword));
+extern flagword elf_xtensa_get_private_bfd_flags
+  PARAMS ((bfd *));
+static bfd_boolean elf_xtensa_print_private_bfd_data
+  PARAMS ((bfd *, PTR));
+static bfd_boolean elf_xtensa_object_p
+  PARAMS ((bfd *));
+static void elf_xtensa_final_write_processing
+  PARAMS ((bfd *, bfd_boolean));
+static enum elf_reloc_type_class elf_xtensa_reloc_type_class
+  PARAMS ((const Elf_Internal_Rela *));
+static bfd_boolean elf_xtensa_discard_info
+  PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_ignore_discarded_relocs
+  PARAMS ((asection *));
+static bfd_boolean elf_xtensa_grok_prstatus
+  PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elf_xtensa_grok_psinfo
+  PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elf_xtensa_new_section_hook
+  PARAMS ((bfd *, asection *));
+
 
 /* Local helper functions.  */
 
-static bfd_boolean add_extra_plt_sections (bfd *, int);
-static char *build_encoding_error_message (xtensa_opcode, bfd_vma);
+static bfd_boolean xtensa_elf_dynamic_symbol_p
+  PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *));
+static int property_table_compare
+  PARAMS ((const PTR, const PTR));
+static bfd_boolean elf_xtensa_in_literal_pool
+  PARAMS ((property_table_entry *, int, bfd_vma));
+static void elf_xtensa_make_sym_local
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static bfd_boolean add_extra_plt_sections
+  PARAMS ((bfd *, int));
+static bfd_boolean elf_xtensa_fix_refcounts
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_xtensa_allocate_plt_size
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_xtensa_allocate_got_size
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+static void elf_xtensa_allocate_local_got_size
+  PARAMS ((struct bfd_link_info *, asection *));
+static bfd_reloc_status_type elf_xtensa_do_reloc
+  PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_vma, bfd_byte *,
+	   bfd_vma, bfd_boolean, char **));
+static char * vsprint_msg
+  VPARAMS ((const char *, const char *, int, ...));
+static char *build_encoding_error_message
+  PARAMS ((xtensa_opcode, xtensa_encode_result));
 static bfd_reloc_status_type bfd_elf_xtensa_reloc
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_boolean do_fix_for_relocatable_link
-  (Elf_Internal_Rela *, bfd *, asection *, bfd_byte *);
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static void do_fix_for_relocatable_link
+  PARAMS ((Elf_Internal_Rela *, bfd *, asection *));
 static void do_fix_for_final_link
-  (Elf_Internal_Rela *, bfd *, asection *, bfd_byte *, bfd_vma *);
+  PARAMS ((Elf_Internal_Rela *, asection *, bfd_vma *));
+static bfd_vma elf_xtensa_create_plt_entry
+  PARAMS ((bfd *, bfd *, unsigned));
+static int elf_xtensa_combine_prop_entries
+  PARAMS ((bfd *, asection *, asection *));
+static bfd_boolean elf_xtensa_discard_info_for_section
+  PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *,
+	   asection *));
 
 /* Local functions to handle Xtensa configurability.  */
 
-static bfd_boolean is_indirect_call_opcode (xtensa_opcode);
-static bfd_boolean is_direct_call_opcode (xtensa_opcode);
-static bfd_boolean is_windowed_call_opcode (xtensa_opcode);
-static xtensa_opcode get_const16_opcode (void);
-static xtensa_opcode get_l32r_opcode (void);
-static bfd_vma l32r_offset (bfd_vma, bfd_vma);
-static int get_relocation_opnd (xtensa_opcode, int);
-static int get_relocation_slot (int);
+static void init_call_opcodes
+  PARAMS ((void));
+static bfd_boolean is_indirect_call_opcode
+  PARAMS ((xtensa_opcode));
+static bfd_boolean is_direct_call_opcode
+  PARAMS ((xtensa_opcode));
+static bfd_boolean is_windowed_call_opcode
+  PARAMS ((xtensa_opcode));
+static xtensa_opcode get_l32r_opcode
+  PARAMS ((void));
+static bfd_vma l32r_offset
+  PARAMS ((bfd_vma, bfd_vma));
+static int get_relocation_opnd
+  PARAMS ((Elf_Internal_Rela *));
 static xtensa_opcode get_relocation_opcode
-  (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *);
+  PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *));
 static bfd_boolean is_l32r_relocation
-  (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *);
-static bfd_boolean is_alt_relocation (int);
-static bfd_boolean is_operand_relocation (int);
-static bfd_size_type insn_decode_len
-  (bfd_byte *, bfd_size_type, bfd_size_type);
-static xtensa_opcode insn_decode_opcode
-  (bfd_byte *, bfd_size_type, bfd_size_type, int);
-static bfd_boolean check_branch_target_aligned
-  (bfd_byte *, bfd_size_type, bfd_vma, bfd_vma);
-static bfd_boolean check_loop_aligned
-  (bfd_byte *, bfd_size_type, bfd_vma, bfd_vma);
-static bfd_boolean check_branch_target_aligned_address (bfd_vma, int);
-static bfd_size_type get_asm_simplify_size
-  (bfd_byte *, bfd_size_type, bfd_size_type);
+  PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *));
 
 /* Functions for link-time code simplifications.  */
 
-static bfd_reloc_status_type elf_xtensa_do_asm_simplify
-  (bfd_byte *, bfd_vma, bfd_vma, char **);
+static bfd_reloc_status_type elf_xtensa_do_asm_simplify 
+  PARAMS ((bfd_byte *, bfd_vma, bfd_vma));
 static bfd_reloc_status_type contract_asm_expansion
-  (bfd_byte *, bfd_vma, Elf_Internal_Rela *, char **);
-static xtensa_opcode swap_callx_for_call_opcode (xtensa_opcode);
-static xtensa_opcode get_expanded_call_opcode (bfd_byte *, int, bfd_boolean *);
+  PARAMS ((bfd_byte *, bfd_vma, Elf_Internal_Rela *));
+static xtensa_opcode swap_callx_for_call_opcode
+  PARAMS ((xtensa_opcode));
+static xtensa_opcode get_expanded_call_opcode
+  PARAMS ((bfd_byte *, int));
 
 /* Access to internal relocations, section contents and symbols.  */
 
 static Elf_Internal_Rela *retrieve_internal_relocs
-  (bfd *, asection *, bfd_boolean);
-static void pin_internal_relocs (asection *, Elf_Internal_Rela *);
-static void release_internal_relocs (asection *, Elf_Internal_Rela *);
-static bfd_byte *retrieve_contents (bfd *, asection *, bfd_boolean);
-static void pin_contents (asection *, bfd_byte *);
-static void release_contents (asection *, bfd_byte *);
-static Elf_Internal_Sym *retrieve_local_syms (bfd *);
+  PARAMS ((bfd *, asection *, bfd_boolean));
+static void pin_internal_relocs
+  PARAMS ((asection *, Elf_Internal_Rela *));
+static void release_internal_relocs
+  PARAMS ((asection *, Elf_Internal_Rela *));
+static bfd_byte *retrieve_contents
+  PARAMS ((bfd *, asection *, bfd_boolean));
+static void pin_contents
+  PARAMS ((asection *, bfd_byte *));
+static void release_contents
+  PARAMS ((asection *, bfd_byte *));
+static Elf_Internal_Sym *retrieve_local_syms
+  PARAMS ((bfd *));
 
 /* Miscellaneous utility functions.  */
 
-static asection *elf_xtensa_get_plt_section (bfd *, int);
-static asection *elf_xtensa_get_gotplt_section (bfd *, int);
-static asection *get_elf_r_symndx_section (bfd *, unsigned long);
+static asection *elf_xtensa_get_plt_section
+  PARAMS ((bfd *, int));
+static asection *elf_xtensa_get_gotplt_section
+  PARAMS ((bfd *, int));
+static asection *get_elf_r_symndx_section
+  PARAMS ((bfd *, unsigned long));
 static struct elf_link_hash_entry *get_elf_r_symndx_hash_entry
-  (bfd *, unsigned long);
-static bfd_vma get_elf_r_symndx_offset (bfd *, unsigned long);
-static bfd_boolean is_reloc_sym_weak (bfd *, Elf_Internal_Rela *);
-static bfd_boolean pcrel_reloc_fits (xtensa_opcode, int, bfd_vma, bfd_vma);
-static bfd_boolean xtensa_is_property_section (asection *);
-static bfd_boolean xtensa_is_littable_section (asection *);
-static int internal_reloc_compare (const void *, const void *);
-static int internal_reloc_matches (const void *, const void *);
-extern char *xtensa_get_property_section_name (asection *, const char *);
-static flagword xtensa_get_property_predef_flags (asection *);
+  PARAMS ((bfd *, unsigned long));
+static bfd_vma get_elf_r_symndx_offset
+  PARAMS ((bfd *, unsigned long));
+static bfd_boolean pcrel_reloc_fits
+  PARAMS ((xtensa_operand, bfd_vma, bfd_vma));
+static bfd_boolean xtensa_is_property_section
+  PARAMS ((asection *));
+static bfd_boolean xtensa_is_littable_section
+  PARAMS ((asection *));
+static bfd_boolean is_literal_section
+  PARAMS ((asection *));
+static int internal_reloc_compare
+  PARAMS ((const PTR, const PTR));
+extern char *xtensa_get_property_section_name
+  PARAMS ((asection *, const char *));
 
 /* Other functions called directly by the linker.  */
 
 typedef void (*deps_callback_t)
-  (asection *, bfd_vma, asection *, bfd_vma, void *);
+  PARAMS ((asection *, bfd_vma, asection *, bfd_vma, PTR));
 extern bfd_boolean xtensa_callback_required_dependence
-  (bfd *, asection *, struct bfd_link_info *, deps_callback_t, void *);
+  PARAMS ((bfd *, asection *, struct bfd_link_info *,
+	   deps_callback_t, PTR));
 
 
-/* Globally visible flag for choosing size optimization of NOP removal
-   instead of branch-target-aware minimization for NOP removal.
-   When nonzero, narrow all instructions and remove all NOPs possible
-   around longcall expansions.  */
-
-int elf32xtensa_size_opt;
-
-
-/* The "new_section_hook" is used to set up a per-section
-   "xtensa_relax_info" data structure with additional information used
-   during relaxation.  */
-
 typedef struct xtensa_relax_info_struct xtensa_relax_info;
 
 
@@ -146,25 +234,12 @@
 static int plt_reloc_count = 0;
 
 
-/* The GNU tools do not easily allow extending interfaces to pass around
-   the pointer to the Xtensa ISA information, so instead we add a global
-   variable here (in BFD) that can be used by any of the tools that need
-   this information. */
-
-xtensa_isa xtensa_default_isa;
-
-
 /* When this is true, relocations may have been modified to refer to
    symbols from other input files.  The per-section list of "fix"
    records needs to be checked when resolving relocations.  */
 
 static bfd_boolean relaxing_section = FALSE;
 
-/* When this is true, during final links, literals that cannot be
-   coalesced and their relocations may be moved to other sections.  */
-
-int elf32xtensa_no_literal_movement = 1;
-
 
 static reloc_howto_type elf_howto_table[] =
 {
@@ -221,115 +296,10 @@
   /* GNU extension to record C++ vtable member usage.  */
   HOWTO (R_XTENSA_GNU_VTENTRY, 0, 2, 0, FALSE, 0, complain_overflow_dont,
          _bfd_elf_rel_vtable_reloc_fn, "R_XTENSA_GNU_VTENTRY",
-	 FALSE, 0x00000000, 0x00000000, FALSE),
-
-  /* Relocations for supporting difference of symbols.  */
-  HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_DIFF8",
-	 FALSE, 0xffffffff, 0xffffffff, FALSE),
-  HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_DIFF16",
-	 FALSE, 0xffffffff, 0xffffffff, FALSE),
-  HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_DIFF32",
-	 FALSE, 0xffffffff, 0xffffffff, FALSE),
-
-  /* General immediate operand relocations.  */
-  HOWTO (R_XTENSA_SLOT0_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT1_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT2_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT3_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT4_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT5_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT6_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT7_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT8_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT9_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT10_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT11_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT12_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT13_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT14_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_OP",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-
-  /* "Alternate" relocations.  The meaning of these is opcode-specific.  */
-  HOWTO (R_XTENSA_SLOT0_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT1_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT2_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT3_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT4_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT5_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT6_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT7_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT8_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT9_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT10_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT11_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT12_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT13_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE),
-  HOWTO (R_XTENSA_SLOT14_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
-	 bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_ALT",
-	 FALSE, 0x00000000, 0x00000000, TRUE)
+	 FALSE, 0x00000000, 0x00000000, FALSE)
 };
 
-#if DEBUG_GEN_RELOC
+#ifdef DEBUG_GEN_RELOC
 #define TRACE(str) \
   fprintf (stderr, "Xtensa bfd reloc lookup %d (%s)\n", code, str)
 #else
@@ -337,8 +307,9 @@
 #endif
 
 static reloc_howto_type *
-elf_xtensa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
-			      bfd_reloc_code_real_type code)
+elf_xtensa_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
 {
   switch (code)
     {
@@ -350,18 +321,6 @@
       TRACE ("BFD_RELOC_32");
       return &elf_howto_table[(unsigned) R_XTENSA_32 ];
 
-    case BFD_RELOC_XTENSA_DIFF8:
-      TRACE ("BFD_RELOC_XTENSA_DIFF8");
-      return &elf_howto_table[(unsigned) R_XTENSA_DIFF8 ];
-
-    case BFD_RELOC_XTENSA_DIFF16:
-      TRACE ("BFD_RELOC_XTENSA_DIFF16");
-      return &elf_howto_table[(unsigned) R_XTENSA_DIFF16 ];
-
-    case BFD_RELOC_XTENSA_DIFF32:
-      TRACE ("BFD_RELOC_XTENSA_DIFF32");
-      return &elf_howto_table[(unsigned) R_XTENSA_DIFF32 ];
-
     case BFD_RELOC_XTENSA_RTLD:
       TRACE ("BFD_RELOC_XTENSA_RTLD");
       return &elf_howto_table[(unsigned) R_XTENSA_RTLD ];
@@ -411,22 +370,6 @@
       return &elf_howto_table[(unsigned) R_XTENSA_GNU_VTENTRY ];
 
     default:
-      if (code >= BFD_RELOC_XTENSA_SLOT0_OP
-	  && code <= BFD_RELOC_XTENSA_SLOT14_OP)
-	{
-	  unsigned n = (R_XTENSA_SLOT0_OP +
-			(code - BFD_RELOC_XTENSA_SLOT0_OP));
-	  return &elf_howto_table[n];
-	}
-
-      if (code >= BFD_RELOC_XTENSA_SLOT0_ALT
-	  && code <= BFD_RELOC_XTENSA_SLOT14_ALT)
-	{
-	  unsigned n = (R_XTENSA_SLOT0_ALT +
-			(code - BFD_RELOC_XTENSA_SLOT0_ALT));
-	  return &elf_howto_table[n];
-	}
-
       break;
     }
 
@@ -439,9 +382,10 @@
    it in the BFD internal arelent representation of the relocation.  */
 
 static void
-elf_xtensa_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
-			       arelent *cache_ptr,
-			       Elf_Internal_Rela *dst)
+elf_xtensa_info_to_howto_rela (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf_Internal_Rela *dst;
 {
   unsigned int r_type = ELF32_R_TYPE (dst->r_info);
 
@@ -502,8 +446,9 @@
 
 
 static inline bfd_boolean
-xtensa_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
-			     struct bfd_link_info *info)
+xtensa_elf_dynamic_symbol_p (h, info)
+     struct elf_link_hash_entry *h;
+     struct bfd_link_info *info;
 {
   /* Check if we should do dynamic things to this symbol.  The
      "ignore_protected" argument need not be set, because Xtensa code
@@ -516,51 +461,15 @@
 
 
 static int
-property_table_compare (const void *ap, const void *bp)
+property_table_compare (ap, bp)
+     const PTR ap;
+     const PTR bp;
 {
   const property_table_entry *a = (const property_table_entry *) ap;
   const property_table_entry *b = (const property_table_entry *) bp;
 
-  if (a->address == b->address)
-    {
-      /* The only circumstance where two entries may legitimately have the
-	 same address is when one of them is a zero-size placeholder to
-	 mark a place where fill can be inserted.  The zero-size entry should
-	 come first.  */
-      BFD_ASSERT ((a->size == 0 || b->size == 0));
-
-      if (a->size != b->size)
-	return (a->size - b->size);
-
-      if ((a->flags & XTENSA_PROP_ALIGN) != (b->flags & XTENSA_PROP_ALIGN))
-	return ((b->flags & XTENSA_PROP_ALIGN)
-		- (a->flags & XTENSA_PROP_ALIGN));
-
-      if ((a->flags & XTENSA_PROP_ALIGN)
-	  && (GET_XTENSA_PROP_ALIGNMENT (a->flags)
-	      != GET_XTENSA_PROP_ALIGNMENT (b->flags)))
-	return (GET_XTENSA_PROP_ALIGNMENT (a->flags)
-		- GET_XTENSA_PROP_ALIGNMENT (b->flags));
-      
-      if ((a->flags & XTENSA_PROP_UNREACHABLE)
-	  != (b->flags & XTENSA_PROP_UNREACHABLE))
-	return ((b->flags & XTENSA_PROP_UNREACHABLE)
-		- (a->flags & XTENSA_PROP_UNREACHABLE));
-
-      return (a->flags - b->flags);
-    }
-
-  return (a->address - b->address);
-}
-
-
-static int
-property_table_matches (const void *ap, const void *bp)
-{
-  const property_table_entry *a = (const property_table_entry *) ap;
-  const property_table_entry *b = (const property_table_entry *) bp;
-
-  /* Check if one entry overlaps with the other.  */
+  /* Check if one entry overlaps with the other; this shouldn't happen
+     except when searching for a match.  */
   if ((b->address >= a->address && b->address < (a->address + a->size))
       || (a->address >= b->address && a->address < (b->address + b->size)))
     return 0;
@@ -569,16 +478,16 @@
 }
 
 
-/* Get the literal table or property table entries for the given
-   section.  Sets TABLE_P and returns the number of entries.  On
-   error, returns a negative value.  */
+/* Get the literal table or instruction table entries for the given
+   section.  Sets TABLE_P and returns the number of entries.  On error,
+   returns a negative value.  */
 
-static int
-xtensa_read_table_entries (bfd *abfd,
-			   asection *section,
-			   property_table_entry **table_p,
-			   const char *sec_name,
-			   bfd_boolean output_addr)
+int
+xtensa_read_table_entries (abfd, section, table_p, sec_name)
+     bfd *abfd;
+     asection *section;
+     property_table_entry **table_p;
+     const char *sec_name;
 {
   asection *table_section;
   char *table_section_name;
@@ -589,44 +498,27 @@
   bfd_size_type num_records;
   Elf_Internal_Rela *internal_relocs;
   bfd_vma section_addr;
-  flagword predef_flags;
-  bfd_size_type table_entry_size;
 
-  if (!section
-      || !(section->flags & SEC_ALLOC)
-      || (section->flags & SEC_DEBUGGING))
-    {
-      *table_p = NULL;
-      return 0;
-    }
-
-  table_section_name = xtensa_get_property_section_name (section, sec_name);
+  table_section_name = 
+    xtensa_get_property_section_name (section, sec_name);
   table_section = bfd_get_section_by_name (abfd, table_section_name);
   free (table_section_name);
-  if (table_section)
+  if (table_section != NULL)
     table_size = table_section->size;
-
+  
   if (table_size == 0) 
     {
       *table_p = NULL;
       return 0;
     }
 
-  predef_flags = xtensa_get_property_predef_flags (table_section);
-  table_entry_size = 12;
-  if (predef_flags)
-    table_entry_size -= 4;
-
-  num_records = table_size / table_entry_size;
+  num_records = table_size / 8;
   table_data = retrieve_contents (abfd, table_section, TRUE);
   blocks = (property_table_entry *)
     bfd_malloc (num_records * sizeof (property_table_entry));
   block_count = 0;
-
-  if (output_addr)
-    section_addr = section->output_section->vma + section->output_offset;
-  else
-    section_addr = section->vma;
+  
+  section_addr = section->output_section->vma + section->output_offset;
 
   /* If the file has not yet been relocated, process the relocations
      and sort out the table entries that apply to the specified section.  */
@@ -649,18 +541,11 @@
 	  if (get_elf_r_symndx_section (abfd, r_symndx) == section)
 	    {
 	      bfd_vma sym_off = get_elf_r_symndx_offset (abfd, r_symndx);
-	      BFD_ASSERT (sym_off == 0);
-	      BFD_ASSERT (rel->r_addend == 0);
 	      blocks[block_count].address =
 		(section_addr + sym_off + rel->r_addend
 		 + bfd_get_32 (abfd, table_data + rel->r_offset));
 	      blocks[block_count].size =
 		bfd_get_32 (abfd, table_data + rel->r_offset + 4);
-	      if (predef_flags)
-		blocks[block_count].flags = predef_flags;
-	      else
-		blocks[block_count].flags =
-		  bfd_get_32 (abfd, table_data + rel->r_offset + 8);
 	      block_count++;
 	    }
 	}
@@ -670,23 +555,17 @@
       /* The file has already been relocated and the addresses are
 	 already in the table.  */
       bfd_vma off;
-      bfd_size_type section_limit = bfd_get_section_limit (abfd, section);
 
-      for (off = 0; off < table_size; off += table_entry_size) 
+      for (off = 0; off < table_size; off += 8) 
 	{
 	  bfd_vma address = bfd_get_32 (abfd, table_data + off);
 
 	  if (address >= section_addr
-	      && address < section_addr + section_limit)
+	      && address < section_addr + section->size)
 	    {
 	      blocks[block_count].address = address;
 	      blocks[block_count].size =
 		bfd_get_32 (abfd, table_data + off + 4);
-	      if (predef_flags)
-		blocks[block_count].flags = predef_flags;
-	      else
-		blocks[block_count].flags =
-		  bfd_get_32 (abfd, table_data + off + 8);
 	      block_count++;
 	    }
 	}
@@ -695,45 +574,34 @@
   release_contents (table_section, table_data);
   release_internal_relocs (table_section, internal_relocs);
 
-  if (block_count > 0)
+  if (block_count > 0) 
     {
       /* Now sort them into address order for easy reference.  */
       qsort (blocks, block_count, sizeof (property_table_entry),
 	     property_table_compare);
     }
-
+    
   *table_p = blocks;
   return block_count;
 }
 
 
-static property_table_entry *
-elf_xtensa_find_property_entry (property_table_entry *property_table,
-				int property_table_size,
-				bfd_vma addr)
+static bfd_boolean
+elf_xtensa_in_literal_pool (lit_table, lit_table_size, addr)
+     property_table_entry *lit_table;
+     int lit_table_size;
+     bfd_vma addr;
 {
   property_table_entry entry;
-  property_table_entry *rv;
 
-  if (property_table_size == 0)
-    return NULL;
+  if (lit_table_size == 0)
+    return FALSE;
 
   entry.address = addr;
   entry.size = 1;
-  entry.flags = 0;
 
-  rv = bsearch (&entry, property_table, property_table_size,
-		sizeof (property_table_entry), property_table_matches);
-  return rv;
-}
-
-
-static bfd_boolean
-elf_xtensa_in_literal_pool (property_table_entry *lit_table,
-			    int lit_table_size,
-			    bfd_vma addr)
-{
-  if (elf_xtensa_find_property_entry (lit_table, lit_table_size, addr))
+  if (bsearch (&entry, lit_table, lit_table_size,
+	       sizeof (property_table_entry), property_table_compare))
     return TRUE;
 
   return FALSE;
@@ -744,10 +612,11 @@
    calculate needed space in the dynamic reloc sections.  */
 
 static bfd_boolean
-elf_xtensa_check_relocs (bfd *abfd,
-			 struct bfd_link_info *info,
-			 asection *sec,
-			 const Elf_Internal_Rela *relocs)
+elf_xtensa_check_relocs (abfd, info, sec, relocs)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *sec;
+     const Elf_Internal_Rela *relocs;
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -845,8 +714,8 @@
 
 		  size = symtab_hdr->sh_info;
 		  size *= sizeof (bfd_signed_vma);
-		  local_got_refcounts =
-		    (bfd_signed_vma *) bfd_zalloc (abfd, size);
+		  local_got_refcounts = ((bfd_signed_vma *)
+					 bfd_zalloc (abfd, size));
 		  if (local_got_refcounts == NULL)
 		    return FALSE;
 		  elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -858,41 +727,8 @@
 	case R_XTENSA_OP0:
 	case R_XTENSA_OP1:
 	case R_XTENSA_OP2:
-	case R_XTENSA_SLOT0_OP:
-	case R_XTENSA_SLOT1_OP:
-	case R_XTENSA_SLOT2_OP:
-	case R_XTENSA_SLOT3_OP:
-	case R_XTENSA_SLOT4_OP:
-	case R_XTENSA_SLOT5_OP:
-	case R_XTENSA_SLOT6_OP:
-	case R_XTENSA_SLOT7_OP:
-	case R_XTENSA_SLOT8_OP:
-	case R_XTENSA_SLOT9_OP:
-	case R_XTENSA_SLOT10_OP:
-	case R_XTENSA_SLOT11_OP:
-	case R_XTENSA_SLOT12_OP:
-	case R_XTENSA_SLOT13_OP:
-	case R_XTENSA_SLOT14_OP:
-	case R_XTENSA_SLOT0_ALT:
-	case R_XTENSA_SLOT1_ALT:
-	case R_XTENSA_SLOT2_ALT:
-	case R_XTENSA_SLOT3_ALT:
-	case R_XTENSA_SLOT4_ALT:
-	case R_XTENSA_SLOT5_ALT:
-	case R_XTENSA_SLOT6_ALT:
-	case R_XTENSA_SLOT7_ALT:
-	case R_XTENSA_SLOT8_ALT:
-	case R_XTENSA_SLOT9_ALT:
-	case R_XTENSA_SLOT10_ALT:
-	case R_XTENSA_SLOT11_ALT:
-	case R_XTENSA_SLOT12_ALT:
-	case R_XTENSA_SLOT13_ALT:
-	case R_XTENSA_SLOT14_ALT:
 	case R_XTENSA_ASM_EXPAND:
 	case R_XTENSA_ASM_SIMPLIFY:
-	case R_XTENSA_DIFF8:
-	case R_XTENSA_DIFF16:
-	case R_XTENSA_DIFF32:
 	  /* Nothing to do for these.  */
 	  break;
 
@@ -920,33 +756,10 @@
 
 
 static void
-elf_xtensa_make_sym_local (struct bfd_link_info *info,
-			   struct elf_link_hash_entry *h)
-{
-  if (info->shared)
-    {
-      if (h->plt.refcount > 0)
-	{
-	  /* Will use RELATIVE relocs instead of JMP_SLOT relocs.  */
-	  if (h->got.refcount < 0)
-	    h->got.refcount = 0;
-	  h->got.refcount += h->plt.refcount;
-	  h->plt.refcount = 0;
-	}
-    }
-  else
-    {
-      /* Don't need any dynamic relocations at all.  */
-      h->plt.refcount = 0;
-      h->got.refcount = 0;
-    }
-}
-
-
-static void
-elf_xtensa_hide_symbol (struct bfd_link_info *info,
-			struct elf_link_hash_entry *h,
-			bfd_boolean force_local)
+elf_xtensa_hide_symbol (info, h, force_local)
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+     bfd_boolean force_local;
 {
   /* For a shared link, move the plt refcount to the got refcount to leave
      space for RELATIVE relocs.  */
@@ -960,13 +773,14 @@
    relocation.  */
 
 static asection *
-elf_xtensa_gc_mark_hook (asection *sec,
-			 struct bfd_link_info *info ATTRIBUTE_UNUSED,
-			 Elf_Internal_Rela *rel,
-			 struct elf_link_hash_entry *h,
-			 Elf_Internal_Sym *sym)
+elf_xtensa_gc_mark_hook (sec, info, rel, h, sym)
+     asection *sec;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     Elf_Internal_Rela *rel;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
 {
-  if (h)
+  if (h != NULL)
     {
       switch (ELF32_R_TYPE (rel->r_info))
 	{
@@ -995,15 +809,15 @@
   return NULL;
 }
 
-
 /* Update the GOT & PLT entry reference counts
    for the section being removed.  */
 
 static bfd_boolean
-elf_xtensa_gc_sweep_hook (bfd *abfd,
-			  struct bfd_link_info *info ATTRIBUTE_UNUSED,
-			  asection *sec,
-			  const Elf_Internal_Rela *relocs)
+elf_xtensa_gc_sweep_hook (abfd, info, sec, relocs)
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sec;
+     const Elf_Internal_Rela *relocs;
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -1062,7 +876,9 @@
 /* Create all the dynamic sections.  */
 
 static bfd_boolean
-elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
+elf_xtensa_create_dynamic_sections (dynobj, info)
+     bfd *dynobj;
+     struct bfd_link_info *info;
 {
   flagword flags, noalloc_flags;
   asection *s;
@@ -1112,7 +928,9 @@
 
 
 static bfd_boolean
-add_extra_plt_sections (bfd *dynobj, int count)
+add_extra_plt_sections (dynobj, count)
+     bfd *dynobj;
+     int count;
 {
   int chunk;
 
@@ -1159,13 +977,14 @@
    understand.  */
 
 static bfd_boolean
-elf_xtensa_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
-				  struct elf_link_hash_entry *h)
+elf_xtensa_adjust_dynamic_symbol (info, h)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct elf_link_hash_entry *h;
 {
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
      real definition first, and we can just use the same value.  */
-  if (h->u.weakdef)
+  if (h->u.weakdef != NULL)
     {
       BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
 		  || h->u.weakdef->root.type == bfd_link_hash_defweak);
@@ -1182,8 +1001,35 @@
 }
 
 
+static void
+elf_xtensa_make_sym_local (info, h)
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+{
+  if (info->shared)
+    {
+      if (h->plt.refcount > 0)
+	{
+	  /* Will use RELATIVE relocs instead of JMP_SLOT relocs.  */
+	  if (h->got.refcount < 0)
+	    h->got.refcount = 0;
+	  h->got.refcount += h->plt.refcount;
+	  h->plt.refcount = 0;
+	}
+    }
+  else
+    {
+      /* Don't need any dynamic relocations at all.  */
+      h->plt.refcount = 0;
+      h->got.refcount = 0;
+    }
+}
+
+
 static bfd_boolean
-elf_xtensa_fix_refcounts (struct elf_link_hash_entry *h, void *arg)
+elf_xtensa_fix_refcounts (h, arg)
+     struct elf_link_hash_entry *h;
+     PTR arg;
 {
   struct bfd_link_info *info = (struct bfd_link_info *) arg;
 
@@ -1198,7 +1044,9 @@
 
 
 static bfd_boolean
-elf_xtensa_allocate_plt_size (struct elf_link_hash_entry *h, void *arg)
+elf_xtensa_allocate_plt_size (h, arg)
+     struct elf_link_hash_entry *h;
+     PTR arg;
 {
   asection *srelplt = (asection *) arg;
 
@@ -1213,7 +1061,9 @@
 
 
 static bfd_boolean
-elf_xtensa_allocate_got_size (struct elf_link_hash_entry *h, void *arg)
+elf_xtensa_allocate_got_size (h, arg)
+     struct elf_link_hash_entry *h;
+     PTR arg;
 {
   asection *srelgot = (asection *) arg;
 
@@ -1228,8 +1078,9 @@
 
 
 static void
-elf_xtensa_allocate_local_got_size (struct bfd_link_info *info,
-				    asection *srelgot)
+elf_xtensa_allocate_local_got_size (info, srelgot)
+     struct bfd_link_info *info;
+     asection *srelgot;
 {
   bfd *i;
 
@@ -1259,8 +1110,9 @@
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
-elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
-				  struct bfd_link_info *info)
+elf_xtensa_size_dynamic_sections (output_bfd, info)
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
 {
   bfd *dynobj, *abfd;
   asection *s, *srelplt, *splt, *sgotplt, *srelgot, *spltlittbl, *sgotloc;
@@ -1296,7 +1148,7 @@
       /* Adjust refcounts for symbols that we now know are not "dynamic".  */
       elf_link_hash_traverse (elf_hash_table (info),
 			      elf_xtensa_fix_refcounts,
-			      (void *) info);
+			      (PTR) info);
 
       /* Allocate space in ".rela.got" for literals that reference
 	 global symbols.  */
@@ -1305,7 +1157,7 @@
 	abort ();
       elf_link_hash_traverse (elf_hash_table (info),
 			      elf_xtensa_allocate_got_size,
-			      (void *) srelgot);
+			      (PTR) srelgot);
 
       /* If we are generating a shared object, we also need space in
 	 ".rela.got" for R_XTENSA_RELATIVE relocs for literals that
@@ -1319,7 +1171,7 @@
 	abort ();
       elf_link_hash_traverse (elf_hash_table (info),
 			      elf_xtensa_allocate_plt_size,
-			      (void *) srelplt);
+			      (PTR) srelplt);
 
       /* Allocate space in ".plt" to match the size of ".rela.plt".  For
 	 each PLT entry, we need the PLT code plus a 4-byte literal.
@@ -1527,13 +1379,14 @@
    this and it probably ought to be moved into elf.c as well.  */
 
 static bfd_boolean
-elf_xtensa_modify_segment_map (bfd *abfd,
-			       struct bfd_link_info *info ATTRIBUTE_UNUSED)
+elf_xtensa_modify_segment_map (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   struct elf_segment_map **m_p;
 
   m_p = &elf_tdata (abfd)->segment_map;
-  while (*m_p)
+  while (*m_p != NULL)
     {
       if ((*m_p)->p_type == PT_LOAD && (*m_p)->count == 0)
 	*m_p = (*m_p)->next;
@@ -1550,42 +1403,32 @@
    howto.  */
 
 #define CALL_SEGMENT_BITS (30)
-#define CALL_SEGMENT_SIZE (1 << CALL_SEGMENT_BITS)
+#define CALL_SEGMENT_SIZE (1<<CALL_SEGMENT_BITS)
 
 static bfd_reloc_status_type
-elf_xtensa_do_reloc (reloc_howto_type *howto,
-		     bfd *abfd,
-		     asection *input_section,
-		     bfd_vma relocation,
-		     bfd_byte *contents,
-		     bfd_vma address,
-		     bfd_boolean is_weak_undef,
-		     char **error_message)
+elf_xtensa_do_reloc (howto, abfd, input_section, relocation,
+		     contents, address, is_weak_undef, error_message)
+     reloc_howto_type *howto;
+     bfd *abfd;
+     asection *input_section;
+     bfd_vma relocation;
+     bfd_byte *contents;
+     bfd_vma address;
+     bfd_boolean is_weak_undef;
+     char **error_message;
 {
-  xtensa_format fmt;
   xtensa_opcode opcode;
+  xtensa_operand operand;
+  xtensa_encode_result encode_result;
   xtensa_isa isa = xtensa_default_isa;
-  static xtensa_insnbuf ibuff = NULL;
-  static xtensa_insnbuf sbuff = NULL;
-  bfd_vma self_address = 0;
-  bfd_size_type input_size;
-  int opnd, slot;
+  xtensa_insnbuf ibuff;
+  bfd_vma self_address;
+  int opnd;
   uint32 newval;
 
-  if (!ibuff)
-    {
-      ibuff = xtensa_insnbuf_alloc (isa);
-      sbuff = xtensa_insnbuf_alloc (isa);
-    }
-
-  input_size = bfd_get_section_limit (abfd, input_section);
-
   switch (howto->type)
     {
     case R_XTENSA_NONE:
-    case R_XTENSA_DIFF8:
-    case R_XTENSA_DIFF16:
-    case R_XTENSA_DIFF32:
       return bfd_reloc_ok;
 
     case R_XTENSA_ASM_EXPAND:
@@ -1594,14 +1437,14 @@
 	  /* Check for windowed CALL across a 1GB boundary.  */
 	  xtensa_opcode opcode =
 	    get_expanded_call_opcode (contents + address,
-				      input_size - address, 0);
+				      input_section->size - address);
 	  if (is_windowed_call_opcode (opcode))
 	    {
 	      self_address = (input_section->output_section->vma
 			      + input_section->output_offset
 			      + address);
-	      if ((self_address >> CALL_SEGMENT_BITS)
-		  != (relocation >> CALL_SEGMENT_BITS)) 
+	      if ((self_address >> CALL_SEGMENT_BITS) !=
+		  (relocation >> CALL_SEGMENT_BITS)) 
 		{
 		  *error_message = "windowed longcall crosses 1GB boundary; "
 		    "return may fail";
@@ -1612,17 +1455,16 @@
       return bfd_reloc_ok;
 
     case R_XTENSA_ASM_SIMPLIFY:
-      {
+      { 
         /* Convert the L32R/CALLX to CALL.  */
-	bfd_reloc_status_type retval =
-	  elf_xtensa_do_asm_simplify (contents, address, input_size,
-				      error_message);
+	bfd_reloc_status_type retval = 
+	  elf_xtensa_do_asm_simplify (contents, address, input_section->size);
 	if (retval != bfd_reloc_ok)
-	  return bfd_reloc_dangerous;
+	  return retval;
 
 	/* The CALL needs to be relocated.  Continue below for that part.  */
 	address += 3;
-	howto = &elf_howto_table[(unsigned) R_XTENSA_SLOT0_OP ];
+	howto = &elf_howto_table[(unsigned) R_XTENSA_OP0 ];
       }
       break;
 
@@ -1637,131 +1479,73 @@
       return bfd_reloc_ok;
     }
 
-  /* Only instruction slot-specific relocations handled below.... */
-  slot = get_relocation_slot (howto->type);
-  if (slot == XTENSA_UNDEFINED)
+  /* Read the instruction into a buffer and decode the opcode.  */
+  ibuff = xtensa_insnbuf_alloc (isa);
+  xtensa_insnbuf_from_chars (isa, ibuff, contents + address);
+  opcode = xtensa_decode_insn (isa, ibuff);
+
+  /* Determine which operand is being relocated.  */
+  if (opcode == XTENSA_UNDEFINED)
+    {
+      *error_message = "cannot decode instruction";
+      return bfd_reloc_dangerous;
+    }
+
+  if (howto->type < R_XTENSA_OP0 || howto->type > R_XTENSA_OP2)
     {
       *error_message = "unexpected relocation";
       return bfd_reloc_dangerous;
     }
 
-  /* Read the instruction into a buffer and decode the opcode.  */
-  xtensa_insnbuf_from_chars (isa, ibuff, contents + address,
-			     input_size - address);
-  fmt = xtensa_format_decode (isa, ibuff);
-  if (fmt == XTENSA_UNDEFINED)
+  opnd = howto->type - R_XTENSA_OP0;
+
+  /* Calculate the PC address for this instruction.  */
+  if (!howto->pc_relative)
     {
-      *error_message = "cannot decode instruction format";
+      *error_message = "expected PC-relative relocation";
       return bfd_reloc_dangerous;
     }
 
-  xtensa_format_get_slot (isa, fmt, slot, ibuff, sbuff);
-
-  opcode = xtensa_opcode_decode (isa, fmt, slot, sbuff);
-  if (opcode == XTENSA_UNDEFINED)
-    {
-      *error_message = "cannot decode instruction opcode";
-      return bfd_reloc_dangerous;
-    }
-
-  /* Check for opcode-specific "alternate" relocations.  */
-  if (is_alt_relocation (howto->type))
-    {
-      if (opcode == get_l32r_opcode ())
-	{
-	  /* Handle the special-case of non-PC-relative L32R instructions.  */
-	  bfd *output_bfd = input_section->output_section->owner;
-	  asection *lit4_sec = bfd_get_section_by_name (output_bfd, ".lit4");
-	  if (!lit4_sec)
-	    {
-	      *error_message = "relocation references missing .lit4 section";
-	      return bfd_reloc_dangerous;
-	    }
-	  self_address = ((lit4_sec->vma & ~0xfff)
-			  + 0x40000 - 3); /* -3 to compensate for do_reloc */
-	  newval = relocation;
-	  opnd = 1;
-	}
-      else if (opcode == get_const16_opcode ())
-	{
-	  /* ALT used for high 16 bits.  */
-	  newval = relocation >> 16;
-	  opnd = 1;
-	}
-      else
-	{
-	  /* No other "alternate" relocations currently defined.  */
-	  *error_message = "unexpected relocation";
-	  return bfd_reloc_dangerous;
-	}
-    }
-  else /* Not an "alternate" relocation.... */
-    {
-      if (opcode == get_const16_opcode ())
-	{
-	  newval = relocation & 0xffff;
-	  opnd = 1;
-	}
-      else
-	{
-	  /* ...normal PC-relative relocation.... */
-
-	  /* Determine which operand is being relocated.  */
-	  opnd = get_relocation_opnd (opcode, howto->type);
-	  if (opnd == XTENSA_UNDEFINED)
-	    {
-	      *error_message = "unexpected relocation";
-	      return bfd_reloc_dangerous;
-	    }
-
-	  if (!howto->pc_relative)
-	    {
-	      *error_message = "expected PC-relative relocation";
-	      return bfd_reloc_dangerous;
-	    }
-
-	  /* Calculate the PC address for this instruction.  */
-	  self_address = (input_section->output_section->vma
-			  + input_section->output_offset
-			  + address);
-
-	  newval = relocation;
-	}
-    }
+  self_address = (input_section->output_section->vma
+		  + input_section->output_offset
+		  + address);
 
   /* Apply the relocation.  */
-  if (xtensa_operand_do_reloc (isa, opcode, opnd, &newval, self_address)
-      || xtensa_operand_encode (isa, opcode, opnd, &newval)
-      || xtensa_operand_set_field (isa, opcode, opnd, fmt, slot,
-				   sbuff, newval))
+  operand = xtensa_get_operand (isa, opcode, opnd);
+  newval = xtensa_operand_do_reloc (operand, relocation, self_address);
+  encode_result = xtensa_operand_encode (operand, &newval);
+  xtensa_operand_set_field (operand, ibuff, newval);
+
+  /* Write the modified instruction back out of the buffer.  */
+  xtensa_insnbuf_to_chars (isa, ibuff, contents + address);
+  free (ibuff);
+
+  if (encode_result != xtensa_encode_result_ok)
     {
-      *error_message = build_encoding_error_message (opcode, relocation);
+      char *message = build_encoding_error_message (opcode, encode_result);
+      *error_message = message;
       return bfd_reloc_dangerous;
     }
 
-  /* Check for calls across 1GB boundaries.  */
+  /* Final check for call.  */
   if (is_direct_call_opcode (opcode)
       && is_windowed_call_opcode (opcode))
     {
-      if ((self_address >> CALL_SEGMENT_BITS)
-	  != (relocation >> CALL_SEGMENT_BITS)) 
+      if ((self_address >> CALL_SEGMENT_BITS) !=
+	  (relocation >> CALL_SEGMENT_BITS)) 
 	{
-	  *error_message =
-	    "windowed call crosses 1GB boundary; return may fail";
+	  *error_message = "windowed call crosses 1GB boundary; "
+	    "return may fail";
 	  return bfd_reloc_dangerous;
 	}
     }
 
-  /* Write the modified instruction back out of the buffer.  */
-  xtensa_format_set_slot (isa, fmt, slot, ibuff, sbuff);
-  xtensa_insnbuf_to_chars (isa, ibuff, contents + address,
-			   input_size - address);
   return bfd_reloc_ok;
 }
 
 
 static char *
-vsprint_msg (const char *origmsg, const char *fmt, int arglen, ...)
+vsprint_msg VPARAMS ((const char *origmsg, const char *fmt, int arglen, ...))
 {
   /* To reduce the size of the memory leak,
      we only use a single message buffer.  */
@@ -1791,27 +1575,55 @@
 
 
 static char *
-build_encoding_error_message (xtensa_opcode opcode, bfd_vma target_address)
+build_encoding_error_message (opcode, encode_result)
+     xtensa_opcode opcode;
+     xtensa_encode_result encode_result;
 {
   const char *opname = xtensa_opcode_name (xtensa_default_isa, opcode);
-  const char *msg;
+  const char *msg = NULL;
 
-  msg = "cannot encode";
-  if (is_direct_call_opcode (opcode))
+  switch (encode_result)
     {
-      if ((target_address & 0x3) != 0)
-	msg = "misaligned call target";
-      else
-	msg = "call target out of range";
-    }
-  else if (opcode == get_l32r_opcode ())
-    {
-      if ((target_address & 0x3) != 0)
-	msg = "misaligned literal target";
-      else
-	msg = "literal target out of range";
+    case xtensa_encode_result_ok:
+      msg = "unexpected valid encoding";
+      break;
+    case xtensa_encode_result_align:
+      msg = "misaligned encoding";
+      break;
+    case xtensa_encode_result_not_in_table:
+      msg = "encoding not in lookup table";
+      break;
+    case xtensa_encode_result_too_low:
+      msg = "encoding out of range: too low";
+      break;
+    case xtensa_encode_result_too_high:
+      msg = "encoding out of range: too high";
+      break;
+    case xtensa_encode_result_not_ok:
+    default:
+      msg = "could not encode";
+      break;
     }
 
+  if (is_direct_call_opcode (opcode)
+      && (encode_result == xtensa_encode_result_too_low
+	  || encode_result == xtensa_encode_result_too_high))
+
+    msg = "direct call out of range";
+
+  else if (opcode == get_l32r_opcode ()) 
+    {
+      /* L32Rs have the strange interaction with encoding in that they
+         have an unsigned immediate field, so libisa returns "too high"
+         when the absolute value is out of range and never returns "too
+         low", but I leave the "too low" message in case anything
+         changes.  */
+      if (encode_result == xtensa_encode_result_too_low)
+	msg = "literal out of range";
+      else if (encode_result == xtensa_encode_result_too_high)
+	msg = "literal placed after use";
+    }
+  
   return vsprint_msg (opname, ": %s", strlen (msg) + 2, msg);
 }
 
@@ -1824,13 +1636,15 @@
    stripped-down version of bfd_perform_relocation.  */
 
 static bfd_reloc_status_type
-bfd_elf_xtensa_reloc (bfd *abfd,
-		      arelent *reloc_entry,
-		      asymbol *symbol,
-		      void *data,
-		      asection *input_section,
-		      bfd *output_bfd,
-		      char **error_message)
+bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section,
+		      output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
 {
   bfd_vma relocation;
   bfd_reloc_status_type flag;
@@ -1851,7 +1665,8 @@
      relocs to begin with, but that's a long story and there's little we
      can do about it now....)  */
 
-  if (output_bfd && (symbol->flags & BSF_SECTION_SYM) == 0)
+  if (output_bfd != (bfd *) NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0)
     {
       reloc_entry->address += input_section->output_offset;
       return bfd_reloc_ok;
@@ -1894,7 +1709,7 @@
 	     to the reloc entry rather than the raw data.  Everything except
 	     relocations against section symbols has already been handled
 	     above.  */
-
+         
 	  BFD_ASSERT (symbol->flags & BSF_SECTION_SYM);
 	  reloc_entry->addend = relocation;
 	  reloc_entry->address += input_section->output_offset;
@@ -1930,9 +1745,10 @@
 /* Set up an entry in the procedure linkage table.  */
 
 static bfd_vma
-elf_xtensa_create_plt_entry (bfd *dynobj,
-			     bfd *output_bfd,
-			     unsigned reloc_index)
+elf_xtensa_create_plt_entry (dynobj, output_bfd, reloc_index)
+      bfd *dynobj;
+      bfd *output_bfd;
+      unsigned reloc_index;
 {
   asection *splt, *sgotplt;
   bfd_vma plt_base, got_base;
@@ -1979,14 +1795,17 @@
    both relocatable and final links.  */
 
 static bfd_boolean
-elf_xtensa_relocate_section (bfd *output_bfd,
-			     struct bfd_link_info *info,
-			     bfd *input_bfd,
-			     asection *input_section,
-			     bfd_byte *contents,
-			     Elf_Internal_Rela *relocs,
-			     Elf_Internal_Sym *local_syms,
-			     asection **local_sections)
+elf_xtensa_relocate_section (output_bfd, info, input_bfd,
+			     input_section, contents, relocs,
+			     local_syms, local_sections)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     bfd *input_bfd;
+     asection *input_section;
+     bfd_byte *contents;
+     Elf_Internal_Rela *relocs;
+     Elf_Internal_Sym *local_syms;
+     asection **local_sections;
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *rel;
@@ -1997,10 +1816,9 @@
   property_table_entry *lit_table = 0;
   int ltblsize = 0;
   char *error_message = NULL;
-  bfd_size_type input_size;
 
-  if (!xtensa_default_isa)
-    xtensa_default_isa = xtensa_isa_init (0, 0);
+  if (xtensa_default_isa == NULL)
+    xtensa_isa_init ();
 
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -2008,7 +1826,7 @@
 
   srelgot = NULL;
   srelplt = NULL;
-  if (dynobj)
+  if (dynobj != NULL)
     {
       srelgot = bfd_get_section_by_name (dynobj, ".rela.got");;
       srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
@@ -2017,14 +1835,11 @@
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       ltblsize = xtensa_read_table_entries (input_bfd, input_section,
-					    &lit_table, XTENSA_LIT_SEC_NAME,
-					    TRUE);
+					    &lit_table, XTENSA_LIT_SEC_NAME);
       if (ltblsize < 0)
 	return FALSE;
     }
 
-  input_size = bfd_get_section_limit (input_bfd, input_section);
-
   rel = relocs;
   relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
@@ -2057,7 +1872,7 @@
 
       if (info->relocatable)
 	{
-	  /* This is a relocatable link.
+	  /* This is a relocatable link. 
 	     1) If the reloc is against a section symbol, adjust
 	     according to the output section.
 	     2) If there is a new target for this relocation,
@@ -2068,26 +1883,15 @@
 	  if (relaxing_section)
 	    {
 	      /* Check if this references a section in another input file.  */
-	      if (!do_fix_for_relocatable_link (rel, input_bfd, input_section,
-						contents))
-		return FALSE;
+	      do_fix_for_relocatable_link (rel, input_bfd, input_section);
 	      r_type = ELF32_R_TYPE (rel->r_info);
 	    }
 
-	  if (r_type == R_XTENSA_ASM_SIMPLIFY)
+	  if (r_type == R_XTENSA_ASM_SIMPLIFY) 
 	    {
-	      char *error_message = NULL;
 	      /* Convert ASM_SIMPLIFY into the simpler relocation
 		 so that they never escape a relaxing link.  */
-	      r = contract_asm_expansion (contents, input_size, rel,
-					  &error_message);
-	      if (r != bfd_reloc_ok)
-		{
-		  if (!((*info->callbacks->reloc_dangerous)
-			(info, error_message, input_bfd, input_section,
-			 rel->r_offset)))
-		    return FALSE;
-		}
+	      contract_asm_expansion (contents, input_section->size, rel);
 	      r_type = ELF32_R_TYPE (rel->r_info);
 	    }
 
@@ -2175,8 +1979,7 @@
       if (relaxing_section)
 	{
 	  /* Check if this references a section in another input file.  */
-	  do_fix_for_final_link (rel, input_bfd, input_section, contents,
-				 &relocation);
+	  do_fix_for_final_link (rel, input_section, &relocation);
 
 	  /* Update some already cached values.  */
 	  r_type = ELF32_R_TYPE (rel->r_info);
@@ -2184,12 +1987,9 @@
 	}
 
       /* Sanity check the address.  */
-      if (rel->r_offset >= input_size
+      if (rel->r_offset >= bfd_get_section_limit (input_bfd, input_section)
 	  && ELF32_R_TYPE (rel->r_info) != R_XTENSA_NONE)
 	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): relocation offset out of range (size=0x%x)"),
-	     input_bfd, input_section, rel->r_offset, input_size);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2199,7 +1999,9 @@
 	{
 	  bfd_boolean dynamic_symbol = xtensa_elf_dynamic_symbol_p (h, info);
 
-	  if (dynamic_symbol && is_operand_relocation (r_type))
+	  if (dynamic_symbol && (r_type == R_XTENSA_OP0
+				 || r_type == R_XTENSA_OP1
+				 || r_type == R_XTENSA_OP2))
 	    {
 	      /* This is an error.  The symbol's real value won't be known
 		 until runtime and it's likely to be out of range anyway.  */
@@ -2271,7 +2073,7 @@
 			  /* Create the PLT entry and set the initial
 			     contents of the literal entry to the address of
 			     the PLT entry.  */
-			  relocation =
+			  relocation = 
 			    elf_xtensa_create_plt_entry (dynobj, output_bfd,
 							 srel->reloc_count);
 			}
@@ -2312,15 +2114,15 @@
 			       relocation + rel->r_addend,
 			       contents, rel->r_offset, is_weak_undef,
 			       &error_message);
-
+      
       if (r != bfd_reloc_ok && !warned)
 	{
 	  const char *name;
 
-	  BFD_ASSERT (r == bfd_reloc_dangerous || r == bfd_reloc_other);
-	  BFD_ASSERT (error_message != NULL);
+	  BFD_ASSERT (r == bfd_reloc_dangerous);
+	  BFD_ASSERT (error_message != (char *) NULL);
 
-	  if (h)
+	  if (h != NULL)
 	    name = h->root.root.string;
 	  else
 	    {
@@ -2330,16 +2132,8 @@
 		name = bfd_section_name (input_bfd, sec);
 	    }
 	  if (name)
-	    {
-	      if (rel->r_addend == 0)
-		error_message = vsprint_msg (error_message, ": %s",
-					     strlen (name) + 2, name);
-	      else
-		error_message = vsprint_msg (error_message, ": (%s+0x%x)",
-					     strlen (name) + 22,
-					     name, rel->r_addend);
-	    }
-
+	    error_message = vsprint_msg (error_message, ": %s",
+					 strlen (name), name);
 	  if (!((*info->callbacks->reloc_dangerous)
 		(info, error_message, input_bfd, input_section,
 		 rel->r_offset)))
@@ -2360,10 +2154,11 @@
    the PLT and GOT entries are all set up by relocate_section.  */
 
 static bfd_boolean
-elf_xtensa_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED,
-				  struct bfd_link_info *info ATTRIBUTE_UNUSED,
-				  struct elf_link_hash_entry *h,
-				  Elf_Internal_Sym *sym)
+elf_xtensa_finish_dynamic_symbol (output_bfd, info, h, sym)
+     bfd *output_bfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
 {
   if (h->needs_plt
       && !h->def_regular)
@@ -2391,9 +2186,10 @@
    on error.  */
 
 static int
-elf_xtensa_combine_prop_entries (bfd *output_bfd,
-				 asection *sxtlit,
-				 asection *sgotloc)
+elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc)
+     bfd *output_bfd;
+     asection *sxtlit;
+     asection *sgotloc;
 {
   bfd_byte *contents;
   property_table_entry *table;
@@ -2409,7 +2205,7 @@
   if (sgotloc_size != section_size)
     {
       (*_bfd_error_handler)
-	(_("internal inconsistency in size of .got.loc section"));
+	("internal inconsistency in size of .got.loc section");
       return -1;
     }
 
@@ -2498,8 +2294,9 @@
 /* Finish up the dynamic sections.  */
 
 static bfd_boolean
-elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
-				    struct bfd_link_info *info)
+elf_xtensa_finish_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
 {
   bfd *dynobj;
   asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc;
@@ -2520,7 +2317,7 @@
     {
       BFD_ASSERT (sgot->size == 4);
       if (sdyn == NULL)
-	bfd_put_32 (output_bfd, 0, sgot->contents);
+	bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
       else
 	bfd_put_32 (output_bfd,
 		    sdyn->output_section->vma + sdyn->output_offset,
@@ -2528,7 +2325,7 @@
     }
 
   srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
-  if (srelplt && srelplt->size != 0)
+  if (srelplt != NULL && srelplt->size != 0)
     {
       asection *sgotplt, *srelgot, *spltlittbl;
       int chunk, plt_chunks, plt_entries;
@@ -2701,7 +2498,9 @@
    object file when linking.  */
 
 static bfd_boolean
-elf_xtensa_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+elf_xtensa_merge_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
 {
   unsigned out_mach, in_mach;
   flagword out_flag, in_flag;
@@ -2720,10 +2519,10 @@
 
   out_mach = out_flag & EF_XTENSA_MACH;
   in_mach = in_flag & EF_XTENSA_MACH;
-  if (out_mach != in_mach)
+  if (out_mach != in_mach) 
     {
       (*_bfd_error_handler)
-	(_("%B: incompatible machine type. Output is 0x%x. Input is 0x%x"),
+	("%B: incompatible machine type. Output is 0x%x. Input is 0x%x",
 	 ibfd, out_mach, in_mach);
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
@@ -2733,27 +2532,31 @@
     {
       elf_flags_init (obfd) = TRUE;
       elf_elfheader (obfd)->e_flags = in_flag;
-
+      
       if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
 	  && bfd_get_arch_info (obfd)->the_default)
 	return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
 				  bfd_get_mach (ibfd));
-
+      
       return TRUE;
     }
 
-  if ((out_flag & EF_XTENSA_XT_INSN) != (in_flag & EF_XTENSA_XT_INSN)) 
-    elf_elfheader (obfd)->e_flags &= (~ EF_XTENSA_XT_INSN);
+  if ((out_flag & EF_XTENSA_XT_INSN) !=
+      (in_flag & EF_XTENSA_XT_INSN)) 
+    elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_INSN);
 
-  if ((out_flag & EF_XTENSA_XT_LIT) != (in_flag & EF_XTENSA_XT_LIT)) 
-    elf_elfheader (obfd)->e_flags &= (~ EF_XTENSA_XT_LIT);
+  if ((out_flag & EF_XTENSA_XT_LIT) !=
+      (in_flag & EF_XTENSA_XT_LIT)) 
+    elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_LIT);
 
   return TRUE;
 }
 
 
 static bfd_boolean
-elf_xtensa_set_private_flags (bfd *abfd, flagword flags)
+elf_xtensa_set_private_flags (abfd, flags)
+     bfd *abfd;
+     flagword flags;
 {
   BFD_ASSERT (!elf_flags_init (abfd)
 	      || elf_elfheader (abfd)->e_flags == flags);
@@ -2765,14 +2568,24 @@
 }
 
 
+extern flagword
+elf_xtensa_get_private_bfd_flags (abfd)
+     bfd *abfd;
+{
+  return elf_elfheader (abfd)->e_flags;
+}
+
+
 static bfd_boolean
-elf_xtensa_print_private_bfd_data (bfd *abfd, void *farg)
+elf_xtensa_print_private_bfd_data (abfd, farg)
+     bfd *abfd;
+     PTR farg;
 {
   FILE *f = (FILE *) farg;
   flagword e_flags = elf_elfheader (abfd)->e_flags;
 
   fprintf (f, "\nXtensa header:\n");
-  if ((e_flags & EF_XTENSA_MACH) == E_XTENSA_MACH)
+  if ((e_flags & EF_XTENSA_MACH) == E_XTENSA_MACH) 
     fprintf (f, "\nMachine     = Base\n");
   else
     fprintf (f, "\nMachine Id  = 0x%x\n", e_flags & EF_XTENSA_MACH);
@@ -2790,7 +2603,8 @@
 /* Set the right machine number for an Xtensa ELF file.  */
 
 static bfd_boolean
-elf_xtensa_object_p (bfd *abfd)
+elf_xtensa_object_p (abfd)
+     bfd *abfd;
 {
   int mach;
   unsigned long arch = elf_elfheader (abfd)->e_flags & EF_XTENSA_MACH;
@@ -2814,8 +2628,9 @@
    number.  */
 
 static void
-elf_xtensa_final_write_processing (bfd *abfd,
-				   bfd_boolean linker ATTRIBUTE_UNUSED)
+elf_xtensa_final_write_processing (abfd, linker)
+     bfd *abfd;
+     bfd_boolean linker ATTRIBUTE_UNUSED;
 {
   int mach;
   unsigned long val;
@@ -2835,7 +2650,8 @@
 
 
 static enum elf_reloc_type_class
-elf_xtensa_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_xtensa_reloc_type_class (rela)
+     const Elf_Internal_Rela *rela;
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -2850,10 +2666,11 @@
 
 
 static bfd_boolean
-elf_xtensa_discard_info_for_section (bfd *abfd,
-				     struct elf_reloc_cookie *cookie,
-				     struct bfd_link_info *info,
-				     asection *sec)
+elf_xtensa_discard_info_for_section (abfd, cookie, info, sec)
+     bfd *abfd;
+     struct elf_reloc_cookie *cookie;
+     struct bfd_link_info *info;
+     asection *sec;
 {
   bfd_byte *contents;
   bfd_vma section_size;
@@ -2974,9 +2791,10 @@
 
 
 static bfd_boolean
-elf_xtensa_discard_info (bfd *abfd,
-			 struct elf_reloc_cookie *cookie,
-			 struct bfd_link_info *info)
+elf_xtensa_discard_info (abfd, cookie, info)
+     bfd *abfd;
+     struct elf_reloc_cookie *cookie;
+     struct bfd_link_info *info;
 {
   asection *sec;
   bfd_boolean changed = FALSE;
@@ -2995,7 +2813,8 @@
 
 
 static bfd_boolean
-elf_xtensa_ignore_discarded_relocs (asection *sec)
+elf_xtensa_ignore_discarded_relocs (sec)
+     asection *sec;
 {
   return xtensa_is_property_section (sec);
 }
@@ -3004,7 +2823,9 @@
 /* Support for core dump NOTE sections.  */
 
 static bfd_boolean
-elf_xtensa_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+elf_xtensa_grok_prstatus (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   int offset;
   unsigned int size;
@@ -3029,7 +2850,9 @@
 
 
 static bfd_boolean
-elf_xtensa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+elf_xtensa_grok_psinfo (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   switch (note->descsz)
     {
@@ -3071,7 +2894,7 @@
 static xtensa_opcode call12_op = XTENSA_UNDEFINED;
 
 static void
-init_call_opcodes (void)
+init_call_opcodes ()
 {
   if (callx0_op == XTENSA_UNDEFINED)
     {
@@ -3088,7 +2911,8 @@
 
 
 static bfd_boolean
-is_indirect_call_opcode (xtensa_opcode opcode)
+is_indirect_call_opcode (opcode)
+     xtensa_opcode opcode;
 {
   init_call_opcodes ();
   return (opcode == callx0_op
@@ -3099,7 +2923,8 @@
 
 
 static bfd_boolean
-is_direct_call_opcode (xtensa_opcode opcode)
+is_direct_call_opcode (opcode)
+     xtensa_opcode opcode;
 {
   init_call_opcodes ();
   return (opcode == call0_op
@@ -3110,7 +2935,8 @@
 
 
 static bfd_boolean
-is_windowed_call_opcode (xtensa_opcode opcode)
+is_windowed_call_opcode (opcode)
+     xtensa_opcode opcode;
 {
   init_call_opcodes ();
   return (opcode == call4_op
@@ -3123,36 +2949,22 @@
 
 
 static xtensa_opcode
-get_const16_opcode (void)
-{
-  static bfd_boolean done_lookup = FALSE;
-  static xtensa_opcode const16_opcode = XTENSA_UNDEFINED;
-  if (!done_lookup)
-    {
-      const16_opcode = xtensa_opcode_lookup (xtensa_default_isa, "const16");
-      done_lookup = TRUE;
-    }
-  return const16_opcode;
-}
-
-
-static xtensa_opcode
 get_l32r_opcode (void)
 {
   static xtensa_opcode l32r_opcode = XTENSA_UNDEFINED;
-  static bfd_boolean done_lookup = FALSE;
-
-  if (!done_lookup)
+  if (l32r_opcode == XTENSA_UNDEFINED)
     {
       l32r_opcode = xtensa_opcode_lookup (xtensa_default_isa, "l32r");
-      done_lookup = TRUE;
+      BFD_ASSERT (l32r_opcode != XTENSA_UNDEFINED);
     }
   return l32r_opcode;
 }
 
 
 static bfd_vma
-l32r_offset (bfd_vma addr, bfd_vma pc)
+l32r_offset (addr, pc)
+     bfd_vma addr;
+     bfd_vma pc;
 {
   bfd_vma offset;
 
@@ -3164,774 +2976,143 @@
 }
 
 
+/* Get the operand number for a PC-relative relocation.
+   If the relocation is not a PC-relative one, return (-1).  */
+
 static int
-get_relocation_opnd (xtensa_opcode opcode, int r_type)
+get_relocation_opnd (irel)
+     Elf_Internal_Rela *irel;
 {
-  xtensa_isa isa = xtensa_default_isa;
-  int last_immed, last_opnd, opi;
-
-  if (opcode == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
-
-  /* Find the last visible PC-relative immediate operand for the opcode.
-     If there are no PC-relative immediates, then choose the last visible
-     immediate; otherwise, fail and return XTENSA_UNDEFINED.  */
-  last_immed = XTENSA_UNDEFINED;
-  last_opnd = xtensa_opcode_num_operands (isa, opcode);
-  for (opi = last_opnd - 1; opi >= 0; opi--)
-    {
-      if (xtensa_operand_is_visible (isa, opcode, opi) == 0)
-	continue;
-      if (xtensa_operand_is_PCrelative (isa, opcode, opi) == 1)
-	{
-	  last_immed = opi;
-	  break;
-	}
-      if (last_immed == XTENSA_UNDEFINED
-	  && xtensa_operand_is_register (isa, opcode, opi) == 0)
-	last_immed = opi;
-    }
-  if (last_immed < 0)
-    return XTENSA_UNDEFINED;
-
-  /* If the operand number was specified in an old-style relocation,
-     check for consistency with the operand computed above.  */
-  if (r_type >= R_XTENSA_OP0 && r_type <= R_XTENSA_OP2)
-    {
-      int reloc_opnd = r_type - R_XTENSA_OP0;
-      if (reloc_opnd != last_immed)
-	return XTENSA_UNDEFINED;
-    }
-
-  return last_immed;
-}
-
-
-int
-get_relocation_slot (int r_type)
-{
-  switch (r_type)
-    {
-    case R_XTENSA_OP0:
-    case R_XTENSA_OP1:
-    case R_XTENSA_OP2:
-      return 0;
-
-    default:
-      if (r_type >= R_XTENSA_SLOT0_OP && r_type <= R_XTENSA_SLOT14_OP)
-	return r_type - R_XTENSA_SLOT0_OP;
-      if (r_type >= R_XTENSA_SLOT0_ALT && r_type <= R_XTENSA_SLOT14_ALT)
-	return r_type - R_XTENSA_SLOT0_ALT;
-      break;
-    }
-
-  return XTENSA_UNDEFINED;
+  if (ELF32_R_TYPE (irel->r_info) < R_XTENSA_OP0
+      || ELF32_R_TYPE (irel->r_info) >= R_XTENSA_max)
+    return -1;
+  return ELF32_R_TYPE (irel->r_info) - R_XTENSA_OP0;
 }
 
 
 /* Get the opcode for a relocation.  */
 
 static xtensa_opcode
-get_relocation_opcode (bfd *abfd,
-		       asection *sec,
-		       bfd_byte *contents,
-		       Elf_Internal_Rela *irel)
+get_relocation_opcode (sec, contents, irel)
+     asection *sec;
+     bfd_byte *contents;
+     Elf_Internal_Rela *irel;
 {
   static xtensa_insnbuf ibuff = NULL;
-  static xtensa_insnbuf sbuff = NULL;
   xtensa_isa isa = xtensa_default_isa;
-  xtensa_format fmt;
-  int slot;
+
+  if (get_relocation_opnd (irel) == -1)
+    return XTENSA_UNDEFINED;
 
   if (contents == NULL)
     return XTENSA_UNDEFINED;
 
-  if (bfd_get_section_limit (abfd, sec) <= irel->r_offset)
+  if (sec->size <= irel->r_offset)
     return XTENSA_UNDEFINED;
 
   if (ibuff == NULL)
-    {
-      ibuff = xtensa_insnbuf_alloc (isa);
-      sbuff = xtensa_insnbuf_alloc (isa);
-    }
-
-  /* Decode the instruction.  */
-  xtensa_insnbuf_from_chars (isa, ibuff, &contents[irel->r_offset],
-			     sec->size - irel->r_offset);
-  fmt = xtensa_format_decode (isa, ibuff);
-  slot = get_relocation_slot (ELF32_R_TYPE (irel->r_info));
-  if (slot == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
-  xtensa_format_get_slot (isa, fmt, slot, ibuff, sbuff);
-  return xtensa_opcode_decode (isa, fmt, slot, sbuff);
-}
-
-
-bfd_boolean
-is_l32r_relocation (bfd *abfd,
-		    asection *sec,
-		    bfd_byte *contents,
-		    Elf_Internal_Rela *irel)
-{
-  xtensa_opcode opcode;
-  if (!is_operand_relocation (ELF32_R_TYPE (irel->r_info)))
-    return FALSE;
-  opcode = get_relocation_opcode (abfd, sec, contents, irel);
-  return (opcode == get_l32r_opcode ());
-}
-
-
-static bfd_size_type
-get_asm_simplify_size (bfd_byte *contents,
-		       bfd_size_type content_len,
-		       bfd_size_type offset)
-{
-  bfd_size_type insnlen, size = 0;
-
-  /* Decode the size of the next two instructions.  */
-  insnlen = insn_decode_len (contents, content_len, offset);
-  if (insnlen == 0)
-    return 0;
-
-  size += insnlen;
-  
-  insnlen = insn_decode_len (contents, content_len, offset + size);
-  if (insnlen == 0)
-    return 0;
-
-  size += insnlen;
-  return size;
-}
-
-
-bfd_boolean
-is_alt_relocation (int r_type)
-{
-  return (r_type >= R_XTENSA_SLOT0_ALT
-	  && r_type <= R_XTENSA_SLOT14_ALT);
-}
-
-
-bfd_boolean
-is_operand_relocation (int r_type)
-{
-  switch (r_type)
-    {
-    case R_XTENSA_OP0:
-    case R_XTENSA_OP1:
-    case R_XTENSA_OP2:
-      return TRUE;
-
-    default:
-      if (r_type >= R_XTENSA_SLOT0_OP && r_type <= R_XTENSA_SLOT14_OP)
-	return TRUE;
-      if (r_type >= R_XTENSA_SLOT0_ALT && r_type <= R_XTENSA_SLOT14_ALT)
-	return TRUE;
-      break;
-    }
-
-  return FALSE;
-}
-
-      
-#define MIN_INSN_LENGTH 2
-
-/* Return 0 if it fails to decode.  */
-
-bfd_size_type
-insn_decode_len (bfd_byte *contents,
-		 bfd_size_type content_len,
-		 bfd_size_type offset)
-{
-  int insn_len;
-  xtensa_isa isa = xtensa_default_isa;
-  xtensa_format fmt;
-  static xtensa_insnbuf ibuff = NULL;
-
-  if (offset + MIN_INSN_LENGTH > content_len)
-    return 0;
-
-  if (ibuff == NULL)
     ibuff = xtensa_insnbuf_alloc (isa);
-  xtensa_insnbuf_from_chars (isa, ibuff, &contents[offset],
-			     content_len - offset);
-  fmt = xtensa_format_decode (isa, ibuff);
-  if (fmt == XTENSA_UNDEFINED)
-    return 0;
-  insn_len = xtensa_format_length (isa, fmt);
-  if (insn_len ==  XTENSA_UNDEFINED)
-    return 0;
-  return insn_len;
+      
+  /* Decode the instruction.  */
+  xtensa_insnbuf_from_chars (isa, ibuff, &contents[irel->r_offset]);
+  return xtensa_decode_insn (isa, ibuff);
 }
 
 
-/* Decode the opcode for a single slot instruction.
-   Return 0 if it fails to decode or the instruction is multi-slot.  */
-
-xtensa_opcode
-insn_decode_opcode (bfd_byte *contents,
-		    bfd_size_type content_len,
-		    bfd_size_type offset,
-		    int slot)
-{
-  xtensa_isa isa = xtensa_default_isa;
-  xtensa_format fmt;
-  static xtensa_insnbuf insnbuf = NULL;
-  static xtensa_insnbuf slotbuf = NULL;
-
-  if (offset + MIN_INSN_LENGTH > content_len)
-    return XTENSA_UNDEFINED;
-
-  if (insnbuf == NULL)
-    {
-      insnbuf = xtensa_insnbuf_alloc (isa);
-      slotbuf = xtensa_insnbuf_alloc (isa);
-    }
-
-  xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
-			     content_len - offset);
-  fmt = xtensa_format_decode (isa, insnbuf);
-  if (fmt == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
-
-  if (slot >= xtensa_format_num_slots (isa, fmt))
-    return XTENSA_UNDEFINED;
-
-  xtensa_format_get_slot (isa, fmt, slot, insnbuf, slotbuf);
-  return xtensa_opcode_decode (isa, fmt, slot, slotbuf);
-}
-
-
-/* The offset is the offset in the contents.
-   The address is the address of that offset.  */
-
-static bfd_boolean
-check_branch_target_aligned (bfd_byte *contents,
-			     bfd_size_type content_length,
-			     bfd_vma offset,
-			     bfd_vma address)
-{
-  bfd_size_type insn_len = insn_decode_len (contents, content_length, offset);
-  if (insn_len == 0)
-    return FALSE;
-  return check_branch_target_aligned_address (address, insn_len);
-}
-
-
-static bfd_boolean
-check_loop_aligned (bfd_byte *contents,
-		    bfd_size_type content_length,
-		    bfd_vma offset,
-		    bfd_vma address)
-{
-  bfd_size_type loop_len, insn_len;
-  xtensa_opcode opcode =
-    insn_decode_opcode (contents, content_length, offset, 0);
-  BFD_ASSERT (opcode != XTENSA_UNDEFINED);
-  if (opcode != XTENSA_UNDEFINED)
-    return FALSE;
-  BFD_ASSERT (xtensa_opcode_is_loop (xtensa_default_isa, opcode));
-  if (!xtensa_opcode_is_loop (xtensa_default_isa, opcode))
-    return FALSE;
-
-  loop_len = insn_decode_len (contents, content_length, offset);
-  BFD_ASSERT (loop_len != 0);
-  if (loop_len == 0)
-    return FALSE;
-
-  insn_len = insn_decode_len (contents, content_length, offset + loop_len);
-  BFD_ASSERT (insn_len != 0);
-  if (insn_len == 0)
-    return FALSE;
-
-  return check_branch_target_aligned_address (address + loop_len, insn_len);
-}
-
-
-static bfd_boolean
-check_branch_target_aligned_address (bfd_vma addr, int len)
-{
-  if (len == 8)
-    return (addr % 8 == 0);
-  return ((addr >> 2) == ((addr + len - 1) >> 2));
-}
-
-
-/* Instruction widening and narrowing.  */
-
-/* When FLIX is available we need to access certain instructions only
-   when they are 16-bit or 24-bit instructions.  This table caches
-   information about such instructions by walking through all the
-   opcodes and finding the smallest single-slot format into which each
-   can be encoded.  */
-
-static xtensa_format *op_single_fmt_table = NULL;
-
-
-static void
-init_op_single_format_table (void)
-{
-  xtensa_isa isa = xtensa_default_isa;
-  xtensa_insnbuf ibuf;
-  xtensa_opcode opcode;
-  xtensa_format fmt;
-  int num_opcodes;
-
-  if (op_single_fmt_table)
-    return;
-
-  ibuf = xtensa_insnbuf_alloc (isa);
-  num_opcodes = xtensa_isa_num_opcodes (isa);
-
-  op_single_fmt_table = (xtensa_format *)
-    bfd_malloc (sizeof (xtensa_format) * num_opcodes);
-  for (opcode = 0; opcode < num_opcodes; opcode++)
-    {
-      op_single_fmt_table[opcode] = XTENSA_UNDEFINED;
-      for (fmt = 0; fmt < xtensa_isa_num_formats (isa); fmt++)
-	{
-	  if (xtensa_format_num_slots (isa, fmt) == 1
-	      && xtensa_opcode_encode (isa, fmt, 0, ibuf, opcode) == 0)
-	    {
-	      xtensa_opcode old_fmt = op_single_fmt_table[opcode];
-	      int fmt_length = xtensa_format_length (isa, fmt);
-	      if (old_fmt == XTENSA_UNDEFINED
-		  || fmt_length < xtensa_format_length (isa, old_fmt))
-		op_single_fmt_table[opcode] = fmt;
-	    }
-	}
-    }
-  xtensa_insnbuf_free (isa, ibuf);
-}
-
-
-static xtensa_format
-get_single_format (xtensa_opcode opcode)
-{
-  init_op_single_format_table ();
-  return op_single_fmt_table[opcode];
-}
-
-
-/* For the set of narrowable instructions we do NOT include the
-   narrowings beqz -> beqz.n or bnez -> bnez.n because of complexities
-   involved during linker relaxation that may require these to
-   re-expand in some conditions.  Also, the narrowing "or" -> mov.n
-   requires special case code to ensure it only works when op1 == op2.  */
-
-struct string_pair
-{
-  const char *wide;
-  const char *narrow;
-};
-
-struct string_pair narrowable[] =
-{
-  { "add", "add.n" },
-  { "addi", "addi.n" },
-  { "addmi", "addi.n" },
-  { "l32i", "l32i.n" },
-  { "movi", "movi.n" },
-  { "ret", "ret.n" },
-  { "retw", "retw.n" },
-  { "s32i", "s32i.n" },
-  { "or", "mov.n" } /* special case only when op1 == op2 */
-};
-
-struct string_pair widenable[] =
-{
-  { "add", "add.n" },
-  { "addi", "addi.n" },
-  { "addmi", "addi.n" },
-  { "beqz", "beqz.n" },
-  { "bnez", "bnez.n" },
-  { "l32i", "l32i.n" },
-  { "movi", "movi.n" },
-  { "ret", "ret.n" },
-  { "retw", "retw.n" },
-  { "s32i", "s32i.n" },
-  { "or", "mov.n" } /* special case only when op1 == op2 */
-};
-
-
-/* Attempt to narrow an instruction.  Return true if the narrowing is
-   valid.  If the do_it parameter is non-zero, then perform the action
-   in-place directly into the contents.  Otherwise, do not modify the
-   contents.  The set of valid narrowing are specified by a string table
-   but require some special case operand checks in some cases.  */
-
-static bfd_boolean
-narrow_instruction (bfd_byte *contents,
-		    bfd_size_type content_length,
-		    bfd_size_type offset,
-		    bfd_boolean do_it)
+bfd_boolean
+is_l32r_relocation (sec, contents, irel)
+     asection *sec;
+     bfd_byte *contents;
+     Elf_Internal_Rela *irel;
 {
   xtensa_opcode opcode;
-  bfd_size_type insn_len, opi;
-  xtensa_isa isa = xtensa_default_isa;
-  xtensa_format fmt, o_fmt;
 
-  static xtensa_insnbuf insnbuf = NULL;
-  static xtensa_insnbuf slotbuf = NULL;
-  static xtensa_insnbuf o_insnbuf = NULL;
-  static xtensa_insnbuf o_slotbuf = NULL;
-
-  if (insnbuf == NULL)
-    {
-      insnbuf = xtensa_insnbuf_alloc (isa);
-      slotbuf = xtensa_insnbuf_alloc (isa);
-      o_insnbuf = xtensa_insnbuf_alloc (isa);
-      o_slotbuf = xtensa_insnbuf_alloc (isa);
-    }
-
-  BFD_ASSERT (offset < content_length);
-
-  if (content_length < 2)
+  if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_OP1)
     return FALSE;
-
-  /* We will hand-code a few of these for a little while.
-     These have all been specified in the assembler aleady.  */
-  xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
-			     content_length - offset);
-  fmt = xtensa_format_decode (isa, insnbuf);
-  if (xtensa_format_num_slots (isa, fmt) != 1)
-    return FALSE;
-
-  if (xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf) != 0)
-    return FALSE;
-
-  opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-  if (opcode == XTENSA_UNDEFINED)
-    return FALSE;
-  insn_len = xtensa_format_length (isa, fmt);
-  if (insn_len > content_length)
-    return FALSE;
-
-  for (opi = 0; opi < (sizeof (narrowable)/sizeof (struct string_pair)); ++opi)
-    {
-      bfd_boolean is_or = (strcmp ("or", narrowable[opi].wide) == 0);
-
-      if (opcode == xtensa_opcode_lookup (isa, narrowable[opi].wide))
-	{
-	  uint32 value, newval;
-	  int i, operand_count, o_operand_count;
-	  xtensa_opcode o_opcode;
-
-	  /* Address does not matter in this case.  We might need to
-	     fix it to handle branches/jumps.  */
-	  bfd_vma self_address = 0;
-
-	  o_opcode = xtensa_opcode_lookup (isa, narrowable[opi].narrow);
-	  if (o_opcode == XTENSA_UNDEFINED)
-	    return FALSE;
-	  o_fmt = get_single_format (o_opcode);
-	  if (o_fmt == XTENSA_UNDEFINED)
-	    return FALSE;
-
-	  if (xtensa_format_length (isa, fmt) != 3
-	      || xtensa_format_length (isa, o_fmt) != 2)
-	    return FALSE;
-
-	  xtensa_format_encode (isa, o_fmt, o_insnbuf);
-	  operand_count = xtensa_opcode_num_operands (isa, opcode);
-	  o_operand_count = xtensa_opcode_num_operands (isa, o_opcode);
-
-	  if (xtensa_opcode_encode (isa, o_fmt, 0, o_slotbuf, o_opcode) != 0)
-	    return FALSE;
-
-	  if (!is_or)
-	    {
-	      if (xtensa_opcode_num_operands (isa, o_opcode) != operand_count)
-		return FALSE;
-	    }
-	  else
-	    {
-	      uint32 rawval0, rawval1, rawval2;
-
-	      if (o_operand_count + 1 != operand_count)
-		return FALSE;
-	      if (xtensa_operand_get_field (isa, opcode, 0,
-					    fmt, 0, slotbuf, &rawval0) != 0)
-		return FALSE;
-	      if (xtensa_operand_get_field (isa, opcode, 1,
-					    fmt, 0, slotbuf, &rawval1) != 0)
-		return FALSE;
-	      if (xtensa_operand_get_field (isa, opcode, 2,
-					    fmt, 0, slotbuf, &rawval2) != 0)
-		return FALSE;
-
-	      if (rawval1 != rawval2)
-		return FALSE;
-	      if (rawval0 == rawval1) /* it is a nop */
-		return FALSE;
-	    }
-
-	  for (i = 0; i < o_operand_count; ++i)
-	    {
-	      if (xtensa_operand_get_field (isa, opcode, i, fmt, 0,
-					    slotbuf, &value)
-		  || xtensa_operand_decode (isa, opcode, i, &value))
-		return FALSE;
-
-	      /* PC-relative branches need adjustment, but
-		 the PC-rel operand will always have a relocation.  */
-	      newval = value;
-	      if (xtensa_operand_do_reloc (isa, o_opcode, i, &newval,
-					   self_address)
-		  || xtensa_operand_encode (isa, o_opcode, i, &newval)
-		  || xtensa_operand_set_field (isa, o_opcode, i, o_fmt, 0,
-					       o_slotbuf, newval))
-		return FALSE;
-	    }
-
-	  if (xtensa_format_set_slot (isa, o_fmt, 0,
-				      o_insnbuf, o_slotbuf) != 0)
-	    return FALSE;
-
-	  if (do_it)
-	    xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
-				     content_length - offset);
-	  return TRUE;
-	}
-    }
-  return FALSE;
-}
-
-
-/* Attempt to widen an instruction.  Return true if the widening is
-   valid.  If the do_it parameter is non-zero, then the action should
-   be performed inplace into the contents.  Otherwise, do not modify
-   the contents.  The set of valid widenings are specified by a string
-   table but require some special case operand checks in some
-   cases.  */
-
-static bfd_boolean
-widen_instruction (bfd_byte *contents,
-		   bfd_size_type content_length,
-		   bfd_size_type offset,
-		   bfd_boolean do_it)
-{
-  xtensa_opcode opcode;
-  bfd_size_type insn_len, opi;
-  xtensa_isa isa = xtensa_default_isa;
-  xtensa_format fmt, o_fmt;
-
-  static xtensa_insnbuf insnbuf = NULL;
-  static xtensa_insnbuf slotbuf = NULL;
-  static xtensa_insnbuf o_insnbuf = NULL;
-  static xtensa_insnbuf o_slotbuf = NULL;
-
-  if (insnbuf == NULL)
-    {
-      insnbuf = xtensa_insnbuf_alloc (isa);
-      slotbuf = xtensa_insnbuf_alloc (isa);
-      o_insnbuf = xtensa_insnbuf_alloc (isa);
-      o_slotbuf = xtensa_insnbuf_alloc (isa);
-    }
-
-  BFD_ASSERT (offset < content_length);
-
-  if (content_length < 2)
-    return FALSE;
-
-  /* We will hand code a few of these for a little while.
-     These have all been specified in the assembler aleady.  */
-  xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
-			     content_length - offset);
-  fmt = xtensa_format_decode (isa, insnbuf);
-  if (xtensa_format_num_slots (isa, fmt) != 1)
-    return FALSE;
-
-  if (xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf) != 0)
-    return FALSE;
-
-  opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-  if (opcode == XTENSA_UNDEFINED)
-    return FALSE;
-  insn_len = xtensa_format_length (isa, fmt);
-  if (insn_len > content_length)
-    return FALSE;
-
-  for (opi = 0; opi < (sizeof (widenable)/sizeof (struct string_pair)); ++opi)
-    {
-      bfd_boolean is_or = (strcmp ("or", widenable[opi].wide) == 0);
-      bfd_boolean is_branch = (strcmp ("beqz", widenable[opi].wide) == 0
-			       || strcmp ("bnez", widenable[opi].wide) == 0);
-
-      if (opcode == xtensa_opcode_lookup (isa, widenable[opi].narrow))
-	{
-	  uint32 value, newval;
-	  int i, operand_count, o_operand_count, check_operand_count;
-	  xtensa_opcode o_opcode;
-
-	  /* Address does not matter in this case.  We might need to fix it
-	     to handle branches/jumps.  */
-	  bfd_vma self_address = 0;
-
-	  o_opcode = xtensa_opcode_lookup (isa, widenable[opi].wide);
-	  if (o_opcode == XTENSA_UNDEFINED)
-	    return FALSE;
-	  o_fmt = get_single_format (o_opcode);
-	  if (o_fmt == XTENSA_UNDEFINED)
-	    return FALSE;
-
-	  if (xtensa_format_length (isa, fmt) != 2
-	      || xtensa_format_length (isa, o_fmt) != 3)
-	    return FALSE;
-
-	  xtensa_format_encode (isa, o_fmt, o_insnbuf);
-	  operand_count = xtensa_opcode_num_operands (isa, opcode);
-	  o_operand_count = xtensa_opcode_num_operands (isa, o_opcode);
-	  check_operand_count = o_operand_count;
-
-	  if (xtensa_opcode_encode (isa, o_fmt, 0, o_slotbuf, o_opcode) != 0)
-	    return FALSE;
-
-	  if (!is_or)
-	    {
-	      if (xtensa_opcode_num_operands (isa, o_opcode) != operand_count)
-		return FALSE;
-	    }
-	  else
-	    {
-	      uint32 rawval0, rawval1;
-
-	      if (o_operand_count != operand_count + 1)
-		return FALSE;
-	      if (xtensa_operand_get_field (isa, opcode, 0,
-					    fmt, 0, slotbuf, &rawval0) != 0)
-		return FALSE;
-	      if (xtensa_operand_get_field (isa, opcode, 1,
-					    fmt, 0, slotbuf, &rawval1) != 0)
-		return FALSE;
-	      if (rawval0 == rawval1) /* it is a nop */
-		return FALSE;
-	    }
-	  if (is_branch)
-	    check_operand_count--;
-
-	  for (i = 0; i < check_operand_count; ++i)
-	    {
-	      int new_i = i;
-	      if (is_or && i == o_operand_count - 1)
-		new_i = i - 1;
-	      if (xtensa_operand_get_field (isa, opcode, new_i, fmt, 0,
-					    slotbuf, &value)
-		  || xtensa_operand_decode (isa, opcode, new_i, &value))
-		return FALSE;
-
-	      /* PC-relative branches need adjustment, but
-		 the PC-rel operand will always have a relocation.  */
-	      newval = value;
-	      if (xtensa_operand_do_reloc (isa, o_opcode, i, &newval,
-					   self_address)
-		  || xtensa_operand_encode (isa, o_opcode, i, &newval)
-		  || xtensa_operand_set_field (isa, o_opcode, i, o_fmt, 0,
-					       o_slotbuf, newval))
-		return FALSE;
-	    }
-
-	  if (xtensa_format_set_slot (isa, o_fmt, 0, o_insnbuf, o_slotbuf))
-	    return FALSE;
-
-	  if (do_it)
-	    xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
-				     content_length - offset);
-	  return TRUE;
-	}
-    }
-  return FALSE;
+  
+  opcode = get_relocation_opcode (sec, contents, irel);
+  return (opcode == get_l32r_opcode ());
 }
 
 
 /* Code for transforming CALLs at link-time.  */
 
 static bfd_reloc_status_type
-elf_xtensa_do_asm_simplify (bfd_byte *contents,
-			    bfd_vma address,
-			    bfd_vma content_length,
-			    char **error_message)
+elf_xtensa_do_asm_simplify (contents, address, content_length)
+     bfd_byte *contents;
+     bfd_vma address;
+     bfd_vma content_length;
 {
   static xtensa_insnbuf insnbuf = NULL;
-  static xtensa_insnbuf slotbuf = NULL;
-  xtensa_format core_format = XTENSA_UNDEFINED;
   xtensa_opcode opcode;
+  xtensa_operand operand;
   xtensa_opcode direct_call_opcode;
   xtensa_isa isa = xtensa_default_isa;
   bfd_byte *chbuf = contents + address;
   int opn;
 
   if (insnbuf == NULL)
-    {
-      insnbuf = xtensa_insnbuf_alloc (isa);
-      slotbuf = xtensa_insnbuf_alloc (isa);
-    }
+    insnbuf = xtensa_insnbuf_alloc (isa);
 
   if (content_length < address)
     {
-      *error_message = _("Attempt to convert L32R/CALLX to CALL failed");
+      (*_bfd_error_handler)
+	("Attempt to convert L32R/CALLX to CALL failed");
       return bfd_reloc_other;
     }
 
-  opcode = get_expanded_call_opcode (chbuf, content_length - address, 0);
+  opcode = get_expanded_call_opcode (chbuf, content_length - address);
   direct_call_opcode = swap_callx_for_call_opcode (opcode);
   if (direct_call_opcode == XTENSA_UNDEFINED)
     {
-      *error_message = _("Attempt to convert L32R/CALLX to CALL failed");
+      (*_bfd_error_handler)
+	("Attempt to convert L32R/CALLX to CALL failed");
       return bfd_reloc_other;
     }
   
   /* Assemble a NOP ("or a1, a1, a1") into the 0 byte offset.  */
-  core_format = xtensa_format_lookup (isa, "x24");
   opcode = xtensa_opcode_lookup (isa, "or");
-  xtensa_opcode_encode (isa, core_format, 0, slotbuf, opcode);
+  xtensa_encode_insn (isa, opcode, insnbuf);
   for (opn = 0; opn < 3; opn++) 
     {
-      uint32 regno = 1;
-      xtensa_operand_encode (isa, opcode, opn, &regno);
-      xtensa_operand_set_field (isa, opcode, opn, core_format, 0,
-				slotbuf, regno);
+      operand = xtensa_get_operand (isa, opcode, opn);
+      xtensa_operand_set_field (operand, insnbuf, 1);
     }
-  xtensa_format_encode (isa, core_format, insnbuf);
-  xtensa_format_set_slot (isa, core_format, 0, insnbuf, slotbuf);
-  xtensa_insnbuf_to_chars (isa, insnbuf, chbuf, content_length - address);
+  xtensa_insnbuf_to_chars (isa, insnbuf, chbuf);
 
   /* Assemble a CALL ("callN 0") into the 3 byte offset.  */
-  xtensa_opcode_encode (isa, core_format, 0, slotbuf, direct_call_opcode);
-  xtensa_operand_set_field (isa, opcode, 0, core_format, 0, slotbuf, 0);
-
-  xtensa_format_encode (isa, core_format, insnbuf);
-  xtensa_format_set_slot (isa, core_format, 0, insnbuf, slotbuf);
-  xtensa_insnbuf_to_chars (isa, insnbuf, chbuf + 3,
-			   content_length - address - 3);
+  xtensa_encode_insn (isa, direct_call_opcode, insnbuf);
+  operand = xtensa_get_operand (isa, opcode, 0);
+  xtensa_operand_set_field (operand, insnbuf, 0);
+  xtensa_insnbuf_to_chars (isa, insnbuf, chbuf + 3);
 
   return bfd_reloc_ok;
 }
 
 
 static bfd_reloc_status_type
-contract_asm_expansion (bfd_byte *contents,
-			bfd_vma content_length,
-			Elf_Internal_Rela *irel,
-			char **error_message)
+contract_asm_expansion (contents, content_length, irel)
+     bfd_byte *contents;
+     bfd_vma content_length;
+     Elf_Internal_Rela *irel;
 {
   bfd_reloc_status_type retval =
-    elf_xtensa_do_asm_simplify (contents, irel->r_offset, content_length,
-				error_message);
+    elf_xtensa_do_asm_simplify (contents, irel->r_offset, content_length);
 
   if (retval != bfd_reloc_ok)
-    return bfd_reloc_dangerous;
+    return retval;
 
   /* Update the irel->r_offset field so that the right immediate and
      the right instruction are modified during the relocation.  */
   irel->r_offset += 3;
-  irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_XTENSA_SLOT0_OP);
+  irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_XTENSA_OP0);
   return bfd_reloc_ok;
 }
 
 
 static xtensa_opcode
-swap_callx_for_call_opcode (xtensa_opcode opcode)
+swap_callx_for_call_opcode (opcode)
+     xtensa_opcode opcode;
 {
   init_call_opcodes ();
 
@@ -3945,103 +3126,54 @@
 }
 
 
-/* Check if "buf" is pointing to a "L32R aN; CALLX aN" or "CONST16 aN;
-   CONST16 aN; CALLX aN" sequence, and if so, return the CALLX opcode.
-   If not, return XTENSA_UNDEFINED.  */
+/* Check if "buf" is pointing to a "L32R aN; CALLX aN" sequence, and
+   if so, return the CALLX opcode.  If not, return XTENSA_UNDEFINED.  */
 
 #define L32R_TARGET_REG_OPERAND 0
-#define CONST16_TARGET_REG_OPERAND 0
 #define CALLN_SOURCE_OPERAND 0
 
 static xtensa_opcode 
-get_expanded_call_opcode (bfd_byte *buf, int bufsize, bfd_boolean *p_uses_l32r)
+get_expanded_call_opcode (buf, bufsize)
+     bfd_byte *buf;
+     int bufsize;
 {
   static xtensa_insnbuf insnbuf = NULL;
-  static xtensa_insnbuf slotbuf = NULL;
-  xtensa_format fmt;
   xtensa_opcode opcode;
+  xtensa_operand operand;
   xtensa_isa isa = xtensa_default_isa;
-  uint32 regno, const16_regno, call_regno;
-  int offset = 0;
+  uint32 regno, call_regno;
+  
+  /* Buffer must be at least 6 bytes.  */
+  if (bufsize < 6)
+    return XTENSA_UNDEFINED;
 
   if (insnbuf == NULL)
-    {
-      insnbuf = xtensa_insnbuf_alloc (isa);
-      slotbuf = xtensa_insnbuf_alloc (isa);
-    }
-
-  xtensa_insnbuf_from_chars (isa, insnbuf, buf, bufsize);
-  fmt = xtensa_format_decode (isa, insnbuf);
-  if (fmt == XTENSA_UNDEFINED
-      || xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf))
+    insnbuf = xtensa_insnbuf_alloc (isa);
+      
+  xtensa_insnbuf_from_chars (isa, insnbuf, buf);
+  opcode = xtensa_decode_insn (isa, insnbuf);
+  
+  if (opcode != get_l32r_opcode ())
     return XTENSA_UNDEFINED;
-
-  opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-  if (opcode == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
-
-  if (opcode == get_l32r_opcode ())
-    {
-      if (p_uses_l32r)
-	*p_uses_l32r = TRUE;
-      if (xtensa_operand_get_field (isa, opcode, L32R_TARGET_REG_OPERAND,
-				    fmt, 0, slotbuf, &regno)
-	  || xtensa_operand_decode (isa, opcode, L32R_TARGET_REG_OPERAND,
-				    &regno))
-	return XTENSA_UNDEFINED;
-    }
-  else if (opcode == get_const16_opcode ())
-    {
-      if (p_uses_l32r)
-	*p_uses_l32r = FALSE;
-      if (xtensa_operand_get_field (isa, opcode, CONST16_TARGET_REG_OPERAND,
-				    fmt, 0, slotbuf, &regno)
-	  || xtensa_operand_decode (isa, opcode, CONST16_TARGET_REG_OPERAND,
-				    &regno))
-	return XTENSA_UNDEFINED;
-
-      /* Check that the next instruction is also CONST16.  */
-      offset += xtensa_format_length (isa, fmt);
-      xtensa_insnbuf_from_chars (isa, insnbuf, buf + offset, bufsize - offset);
-      fmt = xtensa_format_decode (isa, insnbuf);
-      if (fmt == XTENSA_UNDEFINED
-	  || xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf))
-	return XTENSA_UNDEFINED;
-      opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-      if (opcode != get_const16_opcode ())
-	return XTENSA_UNDEFINED;
-
-      if (xtensa_operand_get_field (isa, opcode, CONST16_TARGET_REG_OPERAND,
-				    fmt, 0, slotbuf, &const16_regno)
-	  || xtensa_operand_decode (isa, opcode, CONST16_TARGET_REG_OPERAND,
-				    &const16_regno)
-	  || const16_regno != regno)
-	return XTENSA_UNDEFINED;
-    }
-  else
-    return XTENSA_UNDEFINED;
-
+  
+  operand = xtensa_get_operand (isa, opcode, L32R_TARGET_REG_OPERAND);
+  regno = xtensa_operand_decode
+    (operand, xtensa_operand_get_field (operand, insnbuf));
+  
   /* Next instruction should be an CALLXn with operand 0 == regno.  */
-  offset += xtensa_format_length (isa, fmt);
-  xtensa_insnbuf_from_chars (isa, insnbuf, buf + offset, bufsize - offset);
-  fmt = xtensa_format_decode (isa, insnbuf);
-  if (fmt == XTENSA_UNDEFINED
-      || xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf))
+  xtensa_insnbuf_from_chars (isa, insnbuf, 
+			     buf + xtensa_insn_length (isa, opcode));
+  opcode = xtensa_decode_insn (isa, insnbuf);
+  
+  if (!is_indirect_call_opcode (opcode))
     return XTENSA_UNDEFINED;
-  opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-  if (opcode == XTENSA_UNDEFINED 
-      || !is_indirect_call_opcode (opcode))
-    return XTENSA_UNDEFINED;
-
-  if (xtensa_operand_get_field (isa, opcode, CALLN_SOURCE_OPERAND,
-				fmt, 0, slotbuf, &call_regno)
-      || xtensa_operand_decode (isa, opcode, CALLN_SOURCE_OPERAND,
-				&call_regno))
-    return XTENSA_UNDEFINED;
-
+  
+  operand = xtensa_get_operand (isa, opcode, CALLN_SOURCE_OPERAND);
+  call_regno = xtensa_operand_decode
+    (operand, xtensa_operand_get_field (operand, insnbuf));
   if (call_regno != regno)
     return XTENSA_UNDEFINED;
-
+  
   return opcode;
 }
 
@@ -4059,11 +3191,7 @@
 
    For efficiency, an r_reloc also contains a "target_offset" field to
    cache the target-section-relative offset value that is represented by
-   the relocation.
-   
-   The r_reloc also contains a virtual offset that allows multiple
-   inserted literals to be placed at the same "address" with
-   different offsets.  */
+   the relocation.  */
 
 typedef struct r_reloc_struct r_reloc;
 
@@ -4072,9 +3200,21 @@
   bfd *abfd;
   Elf_Internal_Rela rela;
   bfd_vma target_offset;
-  bfd_vma virtual_offset;
 };
 
+static bfd_boolean r_reloc_is_const
+  PARAMS ((const r_reloc *));
+static void r_reloc_init
+  PARAMS ((r_reloc *, bfd *, Elf_Internal_Rela *));
+static bfd_vma r_reloc_get_target_offset
+  PARAMS ((const r_reloc *));
+static asection *r_reloc_get_section
+  PARAMS ((const r_reloc *));
+static bfd_boolean r_reloc_is_defined
+  PARAMS ((const r_reloc *));
+static struct elf_link_hash_entry *r_reloc_get_hash_entry
+  PARAMS ((const r_reloc *));
+
 
 /* The r_reloc structure is included by value in literal_value, but not
    every literal_value has an associated relocation -- some are simple
@@ -4083,14 +3223,33 @@
    detect this case.  */
 
 static bfd_boolean
-r_reloc_is_const (const r_reloc *r_rel)
+r_reloc_is_const (r_rel)
+     const r_reloc *r_rel;
 {
   return (r_rel->abfd == NULL);
 }
 
 
+static void
+r_reloc_init (r_rel, abfd, irel) 
+     r_reloc *r_rel;
+     bfd *abfd;
+     Elf_Internal_Rela *irel;
+{
+  if (irel != NULL)
+    {
+      r_rel->rela = *irel;
+      r_rel->abfd = abfd;
+      r_rel->target_offset = r_reloc_get_target_offset (r_rel);
+    }
+  else
+    memset (r_rel, 0, sizeof (r_reloc));
+}
+
+
 static bfd_vma
-r_reloc_get_target_offset (const r_reloc *r_rel)
+r_reloc_get_target_offset (r_rel)
+     const r_reloc *r_rel;
 {
   bfd_vma target_offset;
   unsigned long r_symndx;
@@ -4103,7 +3262,8 @@
 
 
 static struct elf_link_hash_entry *
-r_reloc_get_hash_entry (const r_reloc *r_rel)
+r_reloc_get_hash_entry (r_rel)
+     const r_reloc *r_rel;
 {
   unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info);
   return get_elf_r_symndx_hash_entry (r_rel->abfd, r_symndx);
@@ -4111,7 +3271,8 @@
 
 
 static asection *
-r_reloc_get_section (const r_reloc *r_rel)
+r_reloc_get_section (r_rel)
+     const r_reloc *r_rel;
 {
   unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info);
   return get_elf_r_symndx_section (r_rel->abfd, r_symndx);
@@ -4119,13 +3280,10 @@
 
 
 static bfd_boolean
-r_reloc_is_defined (const r_reloc *r_rel)
+r_reloc_is_defined (r_rel)
+     const r_reloc *r_rel;
 {
-  asection *sec;
-  if (r_rel == NULL)
-    return FALSE;
-
-  sec = r_reloc_get_section (r_rel);
+  asection *sec = r_reloc_get_section (r_rel);
   if (sec == bfd_abs_section_ptr
       || sec == bfd_com_section_ptr
       || sec == bfd_und_section_ptr)
@@ -4133,68 +3291,8 @@
   return TRUE;
 }
 
-
-static void
-r_reloc_init (r_reloc *r_rel,
-	      bfd *abfd,
-	      Elf_Internal_Rela *irel,
-	      bfd_byte *contents,
-	      bfd_size_type content_length)
-{
-  int r_type;
-  reloc_howto_type *howto;
-
-  if (irel)
-    {
-      r_rel->rela = *irel;
-      r_rel->abfd = abfd;
-      r_rel->target_offset = r_reloc_get_target_offset (r_rel);
-      r_rel->virtual_offset = 0;
-      r_type = ELF32_R_TYPE (r_rel->rela.r_info);
-      howto = &elf_howto_table[r_type];
-      if (howto->partial_inplace)
-	{
-	  bfd_vma inplace_val;
-	  BFD_ASSERT (r_rel->rela.r_offset < content_length);
-
-	  inplace_val = bfd_get_32 (abfd, &contents[r_rel->rela.r_offset]);
-	  r_rel->target_offset += inplace_val;
-	}
-    }
-  else
-    memset (r_rel, 0, sizeof (r_reloc));
-}
-
-
-#if DEBUG
-
-static void
-print_r_reloc (FILE *fp, const r_reloc *r_rel)
-{
-  if (r_reloc_is_defined (r_rel))
-    {
-      asection *sec = r_reloc_get_section (r_rel);
-      fprintf (fp, " %s(%s + ", sec->owner->filename, sec->name);
-    }
-  else if (r_reloc_get_hash_entry (r_rel))
-    fprintf (fp, " %s + ", r_reloc_get_hash_entry (r_rel)->root.root.string);
-  else
-    fprintf (fp, " ?? + ");
-
-  fprintf_vma (fp, r_rel->target_offset);
-  if (r_rel->virtual_offset)
-    {
-      fprintf (fp, " + ");
-      fprintf_vma (fp, r_rel->virtual_offset);
-    }
-    
-  fprintf (fp, ")");
-}
-
-#endif /* DEBUG */
-
 
-/* source_reloc: relocations that reference literals.  */
+/* source_reloc: relocations that reference literal sections.  */
 
 /* To determine whether literals can be coalesced, we need to first
    record all the relocations that reference the literals.  The
@@ -4217,27 +3315,30 @@
 {
   asection *source_sec;
   r_reloc r_rel;
-  xtensa_opcode opcode;
-  int opnd;
+  xtensa_operand opnd;
   bfd_boolean is_null;
-  bfd_boolean is_abs_literal;
 };
 
 
+static void init_source_reloc
+  PARAMS ((source_reloc *, asection *, const r_reloc *, xtensa_operand));
+static source_reloc *find_source_reloc
+  PARAMS ((source_reloc *, int, asection *, Elf_Internal_Rela *));
+static int source_reloc_compare
+  PARAMS ((const PTR, const PTR));
+
+
 static void
-init_source_reloc (source_reloc *reloc,
-		   asection *source_sec,
-		   const r_reloc *r_rel,
-		   xtensa_opcode opcode,
-		   int opnd,
-		   bfd_boolean is_abs_literal)
+init_source_reloc (reloc, source_sec, r_rel, opnd)
+     source_reloc *reloc;
+     asection *source_sec;
+     const r_reloc *r_rel;
+     xtensa_operand opnd;
 {
   reloc->source_sec = source_sec;
   reloc->r_rel = *r_rel;
-  reloc->opcode = opcode;
   reloc->opnd = opnd;
   reloc->is_null = FALSE;
-  reloc->is_abs_literal = is_abs_literal;
 }
 
 
@@ -4246,10 +3347,11 @@
    just a linear search.  */
 
 static source_reloc *
-find_source_reloc (source_reloc *src_relocs,
-		   int src_count,
-		   asection *sec,
-		   Elf_Internal_Rela *irel)
+find_source_reloc (src_relocs, src_count, sec, irel)
+     source_reloc *src_relocs;
+     int src_count;
+     asection *sec;
+     Elf_Internal_Rela *irel;
 {
   int i;
 
@@ -4267,24 +3369,14 @@
 
 
 static int
-source_reloc_compare (const void *ap, const void *bp)
+source_reloc_compare (ap, bp)
+     const PTR ap;
+     const PTR bp;
 {
   const source_reloc *a = (const source_reloc *) ap;
   const source_reloc *b = (const source_reloc *) bp;
 
-  if (a->r_rel.target_offset != b->r_rel.target_offset)
-    return (a->r_rel.target_offset - b->r_rel.target_offset);
-
-  /* We don't need to sort on these criteria for correctness,
-     but enforcing a more strict ordering prevents unstable qsort
-     from behaving differently with different implementations.
-     Without the code below we get correct but different results
-     on Solaris 2.7 and 2.8.  We would like to always produce the
-     same results no matter the host. */
-
-  if ((!a->is_null) - (!b->is_null))
-    return ((!a->is_null) - (!b->is_null));
-  return internal_reloc_compare (&a->r_rel.rela, &b->r_rel.rela);
+  return (a->r_rel.target_offset - b->r_rel.target_offset);
 }
 
 
@@ -4309,7 +3401,6 @@
 {
   r_reloc r_rel; 
   unsigned long value;
-  bfd_boolean is_abs_literal;
 };
 
 struct value_map_struct
@@ -4324,27 +3415,29 @@
   unsigned bucket_count;
   value_map **buckets;
   unsigned count;
-  bfd_boolean has_last_loc;
-  r_reloc last_loc;
 };
 
 
-static void
-init_literal_value (literal_value *lit,
-		    const r_reloc *r_rel,
-		    unsigned long value,
-		    bfd_boolean is_abs_literal)
-{
-  lit->r_rel = *r_rel;
-  lit->value = value;
-  lit->is_abs_literal = is_abs_literal;
-}
+static bfd_boolean is_same_value
+  PARAMS ((const literal_value *, const literal_value *, bfd_boolean));
+static value_map_hash_table *value_map_hash_table_init
+  PARAMS ((void));
+static unsigned hash_literal_value
+  PARAMS ((const literal_value *));
+static unsigned hash_bfd_vma
+  PARAMS ((bfd_vma));
+static value_map *get_cached_value
+  PARAMS ((value_map_hash_table *, const literal_value *, bfd_boolean));
+static value_map *add_value_map
+  PARAMS ((value_map_hash_table *, const literal_value *, const r_reloc *,
+	   bfd_boolean));
 
 
 static bfd_boolean
-literal_value_equal (const literal_value *src1,
-		     const literal_value *src2,
-		     bfd_boolean final_static_link)
+is_same_value (src1, src2, final_static_link)
+     const literal_value *src1;
+     const literal_value *src2;
+     bfd_boolean final_static_link;
 {
   struct elf_link_hash_entry *h1, *h2;
 
@@ -4358,10 +3451,8 @@
       != ELF32_R_TYPE (src2->r_rel.rela.r_info))
     return FALSE;
 
-  if (src1->r_rel.target_offset != src2->r_rel.target_offset)
-    return FALSE;
-   
-  if (src1->r_rel.virtual_offset != src2->r_rel.virtual_offset)
+  if (r_reloc_get_target_offset (&src1->r_rel)
+      != r_reloc_get_target_offset (&src2->r_rel))
     return FALSE;
 
   if (src1->value != src2->value)
@@ -4387,9 +3478,6 @@
 	return FALSE;
     }
 
-  if (src1->is_abs_literal != src2->is_abs_literal)
-    return FALSE;
-
   return TRUE;
 }
 
@@ -4398,63 +3486,48 @@
 #define INITIAL_HASH_RELOC_BUCKET_COUNT 1024
 
 static value_map_hash_table *
-value_map_hash_table_init (void)
+value_map_hash_table_init ()
 {
   value_map_hash_table *values;
 
   values = (value_map_hash_table *)
-    bfd_zmalloc (sizeof (value_map_hash_table));
+    bfd_malloc (sizeof (value_map_hash_table));
+
   values->bucket_count = INITIAL_HASH_RELOC_BUCKET_COUNT;
   values->count = 0;
   values->buckets = (value_map **)
     bfd_zmalloc (sizeof (value_map *) * values->bucket_count);
-  if (values->buckets == NULL) 
-    {
-      free (values);
-      return NULL;
-    }
-  values->has_last_loc = FALSE;
 
   return values;
 }
 
 
-static void
-value_map_hash_table_delete (value_map_hash_table *table)
-{
-  free (table->buckets);
-  free (table);
-}
-
-
 static unsigned
-hash_bfd_vma (bfd_vma val)
+hash_bfd_vma (val) 
+     bfd_vma val;
 {
   return (val >> 2) + (val >> 10);
 }
 
 
 static unsigned
-literal_value_hash (const literal_value *src)
+hash_literal_value (src)
+     const literal_value *src;
 {
   unsigned hash_val;
 
-  hash_val = hash_bfd_vma (src->value);
-  if (!r_reloc_is_const (&src->r_rel))
-    {
-      void *sec_or_hash;
+  if (r_reloc_is_const (&src->r_rel))
+    return hash_bfd_vma (src->value);
 
-      hash_val += hash_bfd_vma (src->is_abs_literal * 1000);
-      hash_val += hash_bfd_vma (src->r_rel.target_offset);
-      hash_val += hash_bfd_vma (src->r_rel.virtual_offset);
+  hash_val = (hash_bfd_vma (r_reloc_get_target_offset (&src->r_rel))
+	      + hash_bfd_vma (src->value));
   
-      /* Now check for the same section and the same elf_hash.  */
-      if (r_reloc_is_defined (&src->r_rel))
-	sec_or_hash = r_reloc_get_section (&src->r_rel);
-      else
-	sec_or_hash = r_reloc_get_hash_entry (&src->r_rel);
-      hash_val += hash_bfd_vma ((bfd_vma) (unsigned) sec_or_hash);
-    }
+  /* Now check for the same section and the same elf_hash.  */
+  if (r_reloc_is_defined (&src->r_rel))
+    hash_val += hash_bfd_vma ((bfd_vma) (unsigned) r_reloc_get_section (&src->r_rel));
+  else
+    hash_val += hash_bfd_vma ((bfd_vma) (unsigned) r_reloc_get_hash_entry (&src->r_rel));
+
   return hash_val;
 }
 
@@ -4462,20 +3535,21 @@
 /* Check if the specified literal_value has been seen before.  */
 
 static value_map *
-value_map_get_cached_value (value_map_hash_table *map,
-			    const literal_value *val,
-			    bfd_boolean final_static_link)
+get_cached_value (map, val, final_static_link)
+     value_map_hash_table *map;
+     const literal_value *val;
+     bfd_boolean final_static_link;
 {
   value_map *map_e;
   value_map *bucket;
   unsigned idx;
 
-  idx = literal_value_hash (val);
+  idx = hash_literal_value (val);
   idx = idx & (map->bucket_count - 1);
   bucket = map->buckets[idx];
   for (map_e = bucket; map_e; map_e = map_e->next)
     {
-      if (literal_value_equal (&map_e->val, val, final_static_link))
+      if (is_same_value (&map_e->val, val, final_static_link))
 	return map_e;
     }
   return NULL;
@@ -4486,355 +3560,34 @@
    already has an entry here.  */
 
 static value_map *
-add_value_map (value_map_hash_table *map,
-	       const literal_value *val,
-	       const r_reloc *loc,
-	       bfd_boolean final_static_link)
+add_value_map (map, val, loc, final_static_link)
+     value_map_hash_table *map;
+     const literal_value *val;
+     const r_reloc *loc;
+     bfd_boolean final_static_link;
 {
   value_map **bucket_p;
   unsigned idx;
 
   value_map *val_e = (value_map *) bfd_zmalloc (sizeof (value_map));
-  if (val_e == NULL)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return NULL;
-    }
 
-  BFD_ASSERT (!value_map_get_cached_value (map, val, final_static_link));
+  BFD_ASSERT (get_cached_value (map, val, final_static_link) == NULL);
   val_e->val = *val;
   val_e->loc = *loc;
 
-  idx = literal_value_hash (val);
+  idx = hash_literal_value (val);
   idx = idx & (map->bucket_count - 1);
   bucket_p = &map->buckets[idx];
 
   val_e->next = *bucket_p;
   *bucket_p = val_e;
   map->count++;
-  /* FIXME: Consider resizing the hash table if we get too many entries.  */
+  /* FIXME: consider resizing the hash table if we get too many entries */
   
   return val_e;
 }
 
 
-/* Lists of text actions (ta_) for narrowing, widening, longcall
-   conversion, space fill, code & literal removal, etc.  */
-
-/* The following text actions are generated:
-
-   "ta_remove_insn"         remove an instruction or instructions
-   "ta_remove_longcall"     convert longcall to call
-   "ta_convert_longcall"    convert longcall to nop/call
-   "ta_narrow_insn"         narrow a wide instruction
-   "ta_widen"               widen a narrow instruction
-   "ta_fill"                add fill or remove fill
-      removed < 0 is a fill; branches to the fill address will be
-	changed to address + fill size (e.g., address - removed)
-      removed >= 0 branches to the fill address will stay unchanged
-   "ta_remove_literal"      remove a literal; this action is
-			    indicated when a literal is removed
-                            or replaced.
-   "ta_add_literal"         insert a new literal; this action is
-                            indicated when a literal has been moved.
-                            It may use a virtual_offset because
-			    multiple literals can be placed at the
-                            same location.
-
-   For each of these text actions, we also record the number of bytes
-   removed by performing the text action.  In the case of a "ta_widen"
-   or a "ta_fill" that adds space, the removed_bytes will be negative.  */
-
-typedef struct text_action_struct text_action;
-typedef struct text_action_list_struct text_action_list;
-typedef enum text_action_enum_t text_action_t;
-
-enum text_action_enum_t
-{
-  ta_none,
-  ta_remove_insn,        /* removed = -size */
-  ta_remove_longcall,    /* removed = -size */
-  ta_convert_longcall,   /* removed = 0 */
-  ta_narrow_insn,        /* removed = -1 */
-  ta_widen_insn,         /* removed = +1 */
-  ta_fill,               /* removed = +size */
-  ta_remove_literal,
-  ta_add_literal
-};
-
-
-/* Structure for a text action record.  */
-struct text_action_struct
-{
-  text_action_t action;
-  asection *sec;	/* Optional */
-  bfd_vma offset;
-  bfd_vma virtual_offset;  /* Zero except for adding literals.  */
-  int removed_bytes;
-  literal_value value;	/* Only valid when adding literals.  */
-
-  text_action *next;
-};
-
-
-/* List of all of the actions taken on a text section.  */
-struct text_action_list_struct
-{
-  text_action *head;
-};
-
-
-static text_action *
-find_fill_action (text_action_list *l, asection *sec, bfd_vma offset)
-{
-  text_action **m_p;
-
-  /* It is not necessary to fill at the end of a section.  */
-  if (sec->size == offset)
-    return NULL;
-
-  for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next)
-    {
-      text_action *t = *m_p;
-      /* When the action is another fill at the same address,
-	 just increase the size.  */
-      if (t->offset == offset && t->action == ta_fill)
-	return t;
-    }
-  return NULL;
-}
-
-
-static int
-compute_removed_action_diff (const text_action *ta,
-			     asection *sec,
-			     bfd_vma offset,
-			     int removed,
-			     int removable_space)
-{
-  int new_removed;
-  int current_removed = 0;
-
-  if (ta)
-    current_removed = ta->removed_bytes;
-
-  BFD_ASSERT (ta == NULL || ta->offset == offset);
-  BFD_ASSERT (ta == NULL || ta->action == ta_fill);
-
-  /* It is not necessary to fill at the end of a section.  Clean this up.  */
-  if (sec->size == offset)
-    new_removed = removable_space - 0;
-  else
-    {
-      int space;
-      int added = -removed - current_removed;
-      /* Ignore multiples of the section alignment.  */
-      added = ((1 << sec->alignment_power) - 1) & added;
-      new_removed = (-added);
-
-      /* Modify for removable.  */
-      space = removable_space - new_removed;
-      new_removed = (removable_space
-		     - (((1 << sec->alignment_power) - 1) & space));
-    }
-  return (new_removed - current_removed);
-}
-
-
-static void
-adjust_fill_action (text_action *ta, int fill_diff)
-{
-  ta->removed_bytes += fill_diff;
-}
-
-
-/* Add a modification action to the text.  For the case of adding or
-   removing space, modify any current fill and assume that
-   "unreachable_space" bytes can be freely contracted.  Note that a
-   negative removed value is a fill.  */
-
-static void 
-text_action_add (text_action_list *l,
-		 text_action_t action,
-		 asection *sec,
-		 bfd_vma offset,
-		 int removed)
-{
-  text_action **m_p;
-  text_action *ta;
-
-  /* It is not necessary to fill at the end of a section.  */
-  if (action == ta_fill && sec->size == offset)
-    return;
-
-  /* It is not necessary to fill 0 bytes.  */
-  if (action == ta_fill && removed == 0)
-    return;
-
-  for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next)
-    {
-      text_action *t = *m_p;
-      /* When the action is another fill at the same address,
-	 just increase the size.  */
-      if (t->offset == offset && t->action == ta_fill && action == ta_fill)
-	{
-	  t->removed_bytes += removed;
-	  return;
-	}
-    }
-
-  /* Create a new record and fill it up.  */
-  ta = (text_action *) bfd_zmalloc (sizeof (text_action));
-  ta->action = action;
-  ta->sec = sec;
-  ta->offset = offset;
-  ta->removed_bytes = removed;
-  ta->next = (*m_p);
-  *m_p = ta;
-}
-
-
-static void
-text_action_add_literal (text_action_list *l,
-			 text_action_t action,
-			 const r_reloc *loc,
-			 const literal_value *value,
-			 int removed)
-{
-  text_action **m_p;
-  text_action *ta;
-  asection *sec = r_reloc_get_section (loc);
-  bfd_vma offset = loc->target_offset;
-  bfd_vma virtual_offset = loc->virtual_offset;
-
-  BFD_ASSERT (action == ta_add_literal);
-
-  for (m_p = &l->head; *m_p != NULL; m_p = &(*m_p)->next)
-    {
-      if ((*m_p)->offset > offset
-	  && ((*m_p)->offset != offset
-	      || (*m_p)->virtual_offset > virtual_offset))
-	break;
-    }
-
-  /* Create a new record and fill it up.  */
-  ta = (text_action *) bfd_zmalloc (sizeof (text_action));
-  ta->action = action;
-  ta->sec = sec;
-  ta->offset = offset;
-  ta->virtual_offset = virtual_offset;
-  ta->value = *value;
-  ta->removed_bytes = removed;
-  ta->next = (*m_p);
-  *m_p = ta;
-}
-
-
-static bfd_vma 
-offset_with_removed_text (text_action_list *action_list, bfd_vma offset)
-{
-  text_action *r;
-  int removed = 0;
-
-  for (r = action_list->head; r && r->offset <= offset; r = r->next)
-    {
-      if (r->offset < offset
-	  || (r->action == ta_fill && r->removed_bytes < 0))
-	removed += r->removed_bytes;
-    }
-
-  return (offset - removed);
-}
-
-
-static bfd_vma
-offset_with_removed_text_before_fill (text_action_list *action_list,
-				      bfd_vma offset)
-{
-  text_action *r;
-  int removed = 0;
-
-  for (r = action_list->head; r && r->offset < offset; r = r->next)
-    removed += r->removed_bytes;
-
-  return (offset - removed);
-}
-
-
-/* The find_insn_action routine will only find non-fill actions.  */
-
-static text_action *
-find_insn_action (text_action_list *action_list, bfd_vma offset)
-{
-  text_action *t;
-  for (t = action_list->head; t; t = t->next)
-    {
-      if (t->offset == offset)
-	{
-	  switch (t->action)
-	    {
-	    case ta_none:
-	    case ta_fill:
-	      break;
-	    case ta_remove_insn:
-	    case ta_remove_longcall:
-	    case ta_convert_longcall:
-	    case ta_narrow_insn:
-	    case ta_widen_insn:
-	      return t;
-	    case ta_remove_literal:
-	    case ta_add_literal:
-	      BFD_ASSERT (0);
-	      break;
-	    }
-	}
-    }
-  return NULL;
-}
-
-
-#if DEBUG
-
-static void
-print_action_list (FILE *fp, text_action_list *action_list)
-{
-  text_action *r;
-
-  fprintf (fp, "Text Action\n");
-  for (r = action_list->head; r != NULL; r = r->next)
-    {
-      const char *t = "unknown";
-      switch (r->action)
-	{
-	case ta_remove_insn:
-	  t = "remove_insn"; break;
-	case ta_remove_longcall:
-	  t = "remove_longcall"; break;
-	case ta_convert_longcall:
-	  t = "remove_longcall"; break;
-	case ta_narrow_insn:
-	  t = "narrow_insn"; break;
-	case ta_widen_insn:
-	  t = "widen_insn"; break;
-	case ta_fill:
-	  t = "fill"; break;
-	case ta_none:
-	  t = "none"; break;
-	case ta_remove_literal:
-	  t = "remove_literal"; break;
-	case ta_add_literal:
-	  t = "add_literal"; break;
-	}
-
-      fprintf (fp, "%s: %s[0x%lx] \"%s\" %d\n",
-	       r->sec->owner->filename,
-	       r->sec->name, r->offset, t, r->removed_bytes);
-    }
-}
-
-#endif /* DEBUG */
-
-
 /* Lists of literals being coalesced or removed.  */
 
 /* In the usual case, the literal identified by "from" is being
@@ -4860,13 +3613,22 @@
 };
 
 
+static void add_removed_literal
+  PARAMS ((removed_literal_list *, const r_reloc *, const r_reloc *));
+static removed_literal *find_removed_literal
+  PARAMS ((removed_literal_list *, bfd_vma));
+static bfd_vma offset_with_removed_literals
+  PARAMS ((removed_literal_list *, bfd_vma));
+
+
 /* Record that the literal at "from" is being removed.  If "to" is not
    NULL, the "from" literal is being coalesced with the "to" literal.  */
 
 static void
-add_removed_literal (removed_literal_list *removed_list,
-		     const r_reloc *from,
-		     const r_reloc *to)
+add_removed_literal (removed_list, from, to)
+     removed_literal_list *removed_list;
+     const r_reloc *from;
+     const r_reloc *to;
 {
   removed_literal *r, *new_r, *next_r;
 
@@ -4893,7 +3655,8 @@
     }
   else
     {
-      while (r->from.target_offset < from->target_offset && r->next) 
+      while (r->from.target_offset < from->target_offset
+	     && r->next != NULL) 
 	{
 	  r = r->next;
 	}
@@ -4910,7 +3673,9 @@
    given address.  Return the entry if found.  */
 
 static removed_literal *
-find_removed_literal (removed_literal_list *removed_list, bfd_vma addr)
+find_removed_literal (removed_list, addr)
+     removed_literal_list *removed_list;
+     bfd_vma addr;
 {
   removed_literal *r = removed_list->head;
   while (r && r->from.target_offset < addr)
@@ -4921,38 +3686,112 @@
 }
 
 
-#if DEBUG
+/* Adjust an offset in a section to compensate for literals that are
+   being removed.  Search the list of removed literals and subtract
+   4 bytes for every removed literal prior to the given address.  */
 
-static void
-print_removed_literals (FILE *fp, removed_literal_list *removed_list)
+static bfd_vma 
+offset_with_removed_literals (removed_list, addr)
+     removed_literal_list *removed_list;
+     bfd_vma addr;
 {
-  removed_literal *r;
-  r = removed_list->head;
-  if (r)
-    fprintf (fp, "Removed Literals\n");
-  for (; r != NULL; r = r->next)
+  removed_literal *r = removed_list->head;
+  unsigned num_bytes = 0;
+
+  if (r == NULL)
+    return addr;
+
+  while (r && r->from.target_offset <= addr)
     {
-      print_r_reloc (fp, &r->from);
-      fprintf (fp, " => ");
-      if (r->to.abfd == NULL)
-	fprintf (fp, "REMOVED");
-      else
-	print_r_reloc (fp, &r->to);
-      fprintf (fp, "\n");
+      num_bytes += 4;
+      r = r->next;
     }
+  if (num_bytes > addr)
+    return 0;
+  return (addr - num_bytes);
 }
 
-#endif /* DEBUG */
+
+/* Coalescing literals may require a relocation to refer to a section in
+   a different input file, but the standard relocation information
+   cannot express that.  Instead, the reloc_bfd_fix structures are used
+   to "fix" the relocations that refer to sections in other input files.
+   These structures are kept on per-section lists.  The "src_type" field
+   records the relocation type in case there are multiple relocations on
+   the same location.  FIXME: This is ugly; an alternative might be to
+   add new symbols with the "owner" field to some other input file.  */
+
+typedef struct reloc_bfd_fix_struct reloc_bfd_fix;
+
+struct reloc_bfd_fix_struct
+{
+  asection *src_sec;
+  bfd_vma src_offset;
+  unsigned src_type;			/* Relocation type.  */
+  
+  bfd *target_abfd;
+  asection *target_sec;
+  bfd_vma target_offset;
+  
+  reloc_bfd_fix *next;
+};
+
+
+static reloc_bfd_fix *reloc_bfd_fix_init
+  PARAMS ((asection *, bfd_vma, unsigned, bfd *, asection *, bfd_vma));
+static reloc_bfd_fix *get_bfd_fix
+  PARAMS ((reloc_bfd_fix *, asection *, bfd_vma, unsigned));
+
+
+static reloc_bfd_fix *
+reloc_bfd_fix_init (src_sec, src_offset, src_type,
+		    target_abfd, target_sec, target_offset)
+     asection *src_sec;
+     bfd_vma src_offset;
+     unsigned src_type;
+     bfd *target_abfd;
+     asection *target_sec;
+     bfd_vma target_offset;
+{
+  reloc_bfd_fix *fix;
+
+  fix = (reloc_bfd_fix *) bfd_malloc (sizeof (reloc_bfd_fix));
+  fix->src_sec = src_sec;
+  fix->src_offset = src_offset;
+  fix->src_type = src_type;
+  fix->target_abfd = target_abfd;
+  fix->target_sec = target_sec;
+  fix->target_offset = target_offset;
+
+  return fix;
+}
+
+
+static reloc_bfd_fix *
+get_bfd_fix (fix_list, sec, offset, type)
+     reloc_bfd_fix *fix_list;
+     asection *sec;
+     bfd_vma offset;
+     unsigned type;
+{
+  reloc_bfd_fix *r;
+
+  for (r = fix_list; r != NULL; r = r->next) 
+    {
+      if (r->src_sec == sec
+	  && r->src_offset == offset
+	  && r->src_type == type)
+	return r;
+    }
+  return NULL;
+}
 
 
 /* Per-section data for relaxation.  */
 
-typedef struct reloc_bfd_fix_struct reloc_bfd_fix;
-
 struct xtensa_relax_info_struct
 {
   bfd_boolean is_relaxable_literal_section;
-  bfd_boolean is_relaxable_asm_section;
   int visited;				/* Number of times visited.  */
 
   source_reloc *src_relocs;		/* Array[src_count].  */
@@ -4960,20 +3799,8 @@
   int src_next;				/* Next src_relocs entry to assign.  */
 
   removed_literal_list removed_list;
-  text_action_list action_list;
 
   reloc_bfd_fix *fix_list;
-  reloc_bfd_fix *fix_array;
-  unsigned fix_array_count;
-
-  /* Support for expanding the reloc array that is stored
-     in the section structure.  If the relocations have been
-     reallocated, the newly allocated relocations will be referenced
-     here along with the actual size allocated.  The relocation
-     count will always be found in the section structure.  */
-  Elf_Internal_Rela *allocated_relocs; 
-  unsigned relocs_count;
-  unsigned allocated_relocs_count;
 };
 
 struct elf_xtensa_section_data
@@ -4982,9 +3809,18 @@
   xtensa_relax_info relax_info;
 };
 
+static void init_xtensa_relax_info
+  PARAMS ((asection *));
+static xtensa_relax_info *get_xtensa_relax_info
+  PARAMS ((asection *));
+static void add_fix
+  PARAMS ((asection *, reloc_bfd_fix *));
+
 
 static bfd_boolean
-elf_xtensa_new_section_hook (bfd *abfd, asection *sec)
+elf_xtensa_new_section_hook (abfd, sec)
+     bfd *abfd;
+     asection *sec;
 {
   struct elf_xtensa_section_data *sdata;
   bfd_size_type amt = sizeof (*sdata);
@@ -4992,14 +3828,35 @@
   sdata = (struct elf_xtensa_section_data *) bfd_zalloc (abfd, amt);
   if (sdata == NULL)
     return FALSE;
-  sec->used_by_bfd = (void *) sdata;
+  sec->used_by_bfd = (PTR) sdata;
 
   return _bfd_elf_new_section_hook (abfd, sec);
 }
 
 
+static void
+init_xtensa_relax_info (sec)
+     asection *sec;
+{
+  xtensa_relax_info *relax_info = get_xtensa_relax_info (sec);
+
+  relax_info->is_relaxable_literal_section = FALSE;
+  relax_info->visited = 0;
+
+  relax_info->src_relocs = NULL;
+  relax_info->src_count = 0;
+  relax_info->src_next = 0;
+
+  relax_info->removed_list.head = NULL;
+  relax_info->removed_list.tail = NULL;
+
+  relax_info->fix_list = NULL;
+}
+
+
 static xtensa_relax_info *
-get_xtensa_relax_info (asection *sec)
+get_xtensa_relax_info (sec)
+     asection *sec;
 {
   struct elf_xtensa_section_data *section_data;
 
@@ -5013,83 +3870,9 @@
 
 
 static void
-init_xtensa_relax_info (asection *sec)
-{
-  xtensa_relax_info *relax_info = get_xtensa_relax_info (sec);
-
-  relax_info->is_relaxable_literal_section = FALSE;
-  relax_info->is_relaxable_asm_section = FALSE;
-  relax_info->visited = 0;
-
-  relax_info->src_relocs = NULL;
-  relax_info->src_count = 0;
-  relax_info->src_next = 0;
-
-  relax_info->removed_list.head = NULL;
-  relax_info->removed_list.tail = NULL;
-
-  relax_info->action_list.head = NULL;
-
-  relax_info->fix_list = NULL;
-  relax_info->fix_array = NULL;
-  relax_info->fix_array_count = 0;
-
-  relax_info->allocated_relocs = NULL; 
-  relax_info->relocs_count = 0;
-  relax_info->allocated_relocs_count = 0;
-}
-
-
-/* Coalescing literals may require a relocation to refer to a section in
-   a different input file, but the standard relocation information
-   cannot express that.  Instead, the reloc_bfd_fix structures are used
-   to "fix" the relocations that refer to sections in other input files.
-   These structures are kept on per-section lists.  The "src_type" field
-   records the relocation type in case there are multiple relocations on
-   the same location.  FIXME: This is ugly; an alternative might be to
-   add new symbols with the "owner" field to some other input file.  */
-
-struct reloc_bfd_fix_struct
-{
-  asection *src_sec;
-  bfd_vma src_offset;
-  unsigned src_type;			/* Relocation type.  */
-  
-  bfd *target_abfd;
-  asection *target_sec;
-  bfd_vma target_offset;
-  bfd_boolean translated;
-  
-  reloc_bfd_fix *next;
-};
-
-
-static reloc_bfd_fix *
-reloc_bfd_fix_init (asection *src_sec,
-		    bfd_vma src_offset,
-		    unsigned src_type,
-		    bfd *target_abfd,
-		    asection *target_sec,
-		    bfd_vma target_offset,
-		    bfd_boolean translated)
-{
-  reloc_bfd_fix *fix;
-
-  fix = (reloc_bfd_fix *) bfd_malloc (sizeof (reloc_bfd_fix));
-  fix->src_sec = src_sec;
-  fix->src_offset = src_offset;
-  fix->src_type = src_type;
-  fix->target_abfd = target_abfd;
-  fix->target_sec = target_sec;
-  fix->target_offset = target_offset;
-  fix->translated = translated;
-
-  return fix;
-}
-
-
-static void
-add_fix (asection *src_sec, reloc_bfd_fix *fix)
+add_fix (src_sec, fix)
+     asection *src_sec;
+     reloc_bfd_fix *fix;
 {
   xtensa_relax_info *relax_info;
 
@@ -5098,530 +3881,6 @@
   relax_info->fix_list = fix;
 }
 
-
-static int
-fix_compare (const void *ap, const void *bp)
-{
-  const reloc_bfd_fix *a = (const reloc_bfd_fix *) ap;
-  const reloc_bfd_fix *b = (const reloc_bfd_fix *) bp;
-
-  if (a->src_offset != b->src_offset)
-    return (a->src_offset - b->src_offset);
-  return (a->src_type - b->src_type);
-}
-
-
-static void
-cache_fix_array (asection *sec)
-{
-  unsigned i, count = 0;
-  reloc_bfd_fix *r;
-  xtensa_relax_info *relax_info = get_xtensa_relax_info (sec);
-
-  if (relax_info == NULL)
-    return;
-  if (relax_info->fix_list == NULL)
-    return;
-
-  for (r = relax_info->fix_list; r != NULL; r = r->next)
-    count++;
-
-  relax_info->fix_array =
-    (reloc_bfd_fix *) bfd_malloc (sizeof (reloc_bfd_fix) * count);
-  relax_info->fix_array_count = count;
-
-  r = relax_info->fix_list;
-  for (i = 0; i < count; i++, r = r->next)
-    {
-      relax_info->fix_array[count - 1 - i] = *r;
-      relax_info->fix_array[count - 1 - i].next = NULL;
-    }
-
-  qsort (relax_info->fix_array, relax_info->fix_array_count,
-	 sizeof (reloc_bfd_fix), fix_compare);
-}
-
-
-static reloc_bfd_fix *
-get_bfd_fix (asection *sec, bfd_vma offset, unsigned type)
-{
-  xtensa_relax_info *relax_info = get_xtensa_relax_info (sec);
-  reloc_bfd_fix *rv;
-  reloc_bfd_fix key;
-
-  if (relax_info == NULL)
-    return NULL;
-  if (relax_info->fix_list == NULL)
-    return NULL;
-
-  if (relax_info->fix_array == NULL)
-    cache_fix_array (sec);
-
-  key.src_offset = offset;
-  key.src_type = type;
-  rv = bsearch (&key, relax_info->fix_array,  relax_info->fix_array_count,
-		sizeof (reloc_bfd_fix), fix_compare);
-  return rv;
-}
-
-
-/* Section caching.  */
-
-typedef struct section_cache_struct section_cache_t;
-
-struct section_cache_struct
-{
-  asection *sec;
-
-  bfd_byte *contents;		/* Cache of the section contents.  */
-  bfd_size_type content_length;
-
-  property_table_entry *ptbl;	/* Cache of the section property table.  */
-  unsigned pte_count;
-
-  Elf_Internal_Rela *relocs;	/* Cache of the section relocations.  */
-  unsigned reloc_count;
-};
-
-
-static void
-init_section_cache (section_cache_t *sec_cache)
-{
-  memset (sec_cache, 0, sizeof (*sec_cache));
-}
-
-
-static void
-clear_section_cache (section_cache_t *sec_cache)
-{
-  if (sec_cache->sec)
-    {
-      release_contents (sec_cache->sec, sec_cache->contents);
-      release_internal_relocs (sec_cache->sec, sec_cache->relocs);
-      if (sec_cache->ptbl)
-	free (sec_cache->ptbl);
-      memset (sec_cache, 0, sizeof (sec_cache));
-    }
-}
-
-
-static bfd_boolean
-section_cache_section (section_cache_t *sec_cache,
-		       asection *sec,
-		       struct bfd_link_info *link_info)
-{
-  bfd *abfd;
-  property_table_entry *prop_table = NULL;
-  int ptblsize = 0;
-  bfd_byte *contents = NULL;
-  Elf_Internal_Rela *internal_relocs = NULL;
-  bfd_size_type sec_size;
-
-  if (sec == NULL)
-    return FALSE;
-  if (sec == sec_cache->sec)
-    return TRUE;
-
-  abfd = sec->owner;
-  sec_size = bfd_get_section_limit (abfd, sec);
-
-  /* Get the contents.  */
-  contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
-    goto err;
-
-  /* Get the relocations.  */
-  internal_relocs = retrieve_internal_relocs (abfd, sec,
-					      link_info->keep_memory);
-
-  /* Get the entry table.  */
-  ptblsize = xtensa_read_table_entries (abfd, sec, &prop_table,
-					XTENSA_PROP_SEC_NAME, FALSE);
-  if (ptblsize < 0)
-    goto err;
-
-  /* Fill in the new section cache.  */
-  clear_section_cache (sec_cache);
-  memset (sec_cache, 0, sizeof (sec_cache));
-
-  sec_cache->sec = sec;
-  sec_cache->contents = contents;
-  sec_cache->content_length = sec_size;
-  sec_cache->relocs = internal_relocs;
-  sec_cache->reloc_count = sec->reloc_count;
-  sec_cache->pte_count = ptblsize;
-  sec_cache->ptbl = prop_table;
-
-  return TRUE;
-
- err:
-  release_contents (sec, contents);
-  release_internal_relocs (sec, internal_relocs);
-  if (prop_table)
-    free (prop_table);
-  return FALSE;
-}
-
-
-/* Extended basic blocks.  */
-
-/* An ebb_struct represents an Extended Basic Block.  Within this
-   range, we guarantee that all instructions are decodable, the
-   property table entries are contiguous, and no property table
-   specifies a segment that cannot have instructions moved.  This
-   structure contains caches of the contents, property table and
-   relocations for the specified section for easy use.  The range is
-   specified by ranges of indices for the byte offset, property table
-   offsets and relocation offsets.  These must be consistent.  */
-
-typedef struct ebb_struct ebb_t;
-
-struct ebb_struct
-{
-  asection *sec;
-
-  bfd_byte *contents;		/* Cache of the section contents.  */
-  bfd_size_type content_length;
-
-  property_table_entry *ptbl;	/* Cache of the section property table.  */
-  unsigned pte_count;
-
-  Elf_Internal_Rela *relocs;	/* Cache of the section relocations.  */
-  unsigned reloc_count;
-
-  bfd_vma start_offset;		/* Offset in section.  */
-  unsigned start_ptbl_idx;	/* Offset in the property table.  */
-  unsigned start_reloc_idx;	/* Offset in the relocations.  */
-
-  bfd_vma end_offset;
-  unsigned end_ptbl_idx;
-  unsigned end_reloc_idx;
-
-  bfd_boolean ends_section;	/* Is this the last ebb in a section?  */
-
-  /* The unreachable property table at the end of this set of blocks;
-     NULL if the end is not an unreachable block.  */
-  property_table_entry *ends_unreachable;
-};
-
-
-enum ebb_target_enum
-{
-  EBB_NO_ALIGN = 0,
-  EBB_DESIRE_TGT_ALIGN,
-  EBB_REQUIRE_TGT_ALIGN,
-  EBB_REQUIRE_LOOP_ALIGN,
-  EBB_REQUIRE_ALIGN
-};
-
-
-/* proposed_action_struct is similar to the text_action_struct except
-   that is represents a potential transformation, not one that will
-   occur.  We build a list of these for an extended basic block
-   and use them to compute the actual actions desired.  We must be
-   careful that the entire set of actual actions we perform do not
-   break any relocations that would fit if the actions were not
-   performed.  */
-
-typedef struct proposed_action_struct proposed_action;
-
-struct proposed_action_struct
-{
-  enum ebb_target_enum align_type; /* for the target alignment */
-  bfd_vma alignment_pow;
-  text_action_t action;
-  bfd_vma offset;
-  int removed_bytes;
-  bfd_boolean do_action; /* If false, then we will not perform the action.  */
-};
-
-
-/* The ebb_constraint_struct keeps a set of proposed actions for an
-   extended basic block.   */
-
-typedef struct ebb_constraint_struct ebb_constraint;
-
-struct ebb_constraint_struct
-{
-  ebb_t ebb;
-  bfd_boolean start_movable;
-
-  /* Bytes of extra space at the beginning if movable.  */
-  int start_extra_space;
-
-  enum ebb_target_enum start_align;
-
-  bfd_boolean end_movable;
-
-  /* Bytes of extra space at the end if movable.  */
-  int end_extra_space;
-
-  unsigned action_count;
-  unsigned action_allocated;
-
-  /* Array of proposed actions.  */
-  proposed_action *actions;
-
-  /* Action alignments -- one for each proposed action.  */
-  enum ebb_target_enum *action_aligns;
-};
-
-
-static void
-init_ebb_constraint (ebb_constraint *c)
-{
-  memset (c, 0, sizeof (ebb_constraint));
-}
-
-
-static void
-free_ebb_constraint (ebb_constraint *c)
-{
-  if (c->actions)
-    free (c->actions);
-}
-
-
-static void
-init_ebb (ebb_t *ebb,
-	  asection *sec,
-	  bfd_byte *contents,
-	  bfd_size_type content_length,
-	  property_table_entry *prop_table,
-	  unsigned ptblsize,
-	  Elf_Internal_Rela *internal_relocs,
-	  unsigned reloc_count)
-{
-  memset (ebb, 0, sizeof (ebb_t));
-  ebb->sec = sec;
-  ebb->contents = contents;
-  ebb->content_length = content_length;
-  ebb->ptbl = prop_table;
-  ebb->pte_count = ptblsize;
-  ebb->relocs = internal_relocs;
-  ebb->reloc_count = reloc_count;
-  ebb->start_offset = 0;
-  ebb->end_offset = ebb->content_length - 1;
-  ebb->start_ptbl_idx = 0;
-  ebb->end_ptbl_idx = ptblsize;
-  ebb->start_reloc_idx = 0;
-  ebb->end_reloc_idx = reloc_count;
-}
-
-
-/* Extend the ebb to all decodable contiguous sections.  The algorithm
-   for building a basic block around an instruction is to push it
-   forward until we hit the end of a section, an unreachable block or
-   a block that cannot be transformed.  Then we push it backwards
-   searching for similar conditions.  */
-
-static bfd_boolean extend_ebb_bounds_forward (ebb_t *);
-static bfd_boolean extend_ebb_bounds_backward (ebb_t *);
-static bfd_size_type insn_block_decodable_len
-  (bfd_byte *, bfd_size_type, bfd_vma, bfd_size_type);
-
-static bfd_boolean
-extend_ebb_bounds (ebb_t *ebb)
-{
-  if (!extend_ebb_bounds_forward (ebb))
-    return FALSE;
-  if (!extend_ebb_bounds_backward (ebb))
-    return FALSE;
-  return TRUE;
-}
-
-
-static bfd_boolean
-extend_ebb_bounds_forward (ebb_t *ebb)
-{
-  property_table_entry *the_entry, *new_entry;
-
-  the_entry = &ebb->ptbl[ebb->end_ptbl_idx];
-
-  /* Stop when (1) we cannot decode an instruction, (2) we are at
-     the end of the property tables, (3) we hit a non-contiguous property
-     table entry, (4) we hit a NO_TRANSFORM region.  */
-
-  while (1)
-    {
-      bfd_vma entry_end;
-      bfd_size_type insn_block_len;
-
-      entry_end = the_entry->address - ebb->sec->vma + the_entry->size;
-      insn_block_len =
-	insn_block_decodable_len (ebb->contents, ebb->content_length,
-				  ebb->end_offset,
-				  entry_end - ebb->end_offset);
-      if (insn_block_len != (entry_end - ebb->end_offset))
-	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
-	     ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
-	  return FALSE;
-	}
-      ebb->end_offset += insn_block_len;
-
-      if (ebb->end_offset == ebb->sec->size)
-	ebb->ends_section = TRUE;
-
-      /* Update the reloc counter.  */
-      while (ebb->end_reloc_idx + 1 < ebb->reloc_count
-	     && (ebb->relocs[ebb->end_reloc_idx + 1].r_offset
-		 < ebb->end_offset))
-	{
-	  ebb->end_reloc_idx++;
-	}
-
-      if (ebb->end_ptbl_idx + 1 == ebb->pte_count)
-	return TRUE;
-
-      new_entry = &ebb->ptbl[ebb->end_ptbl_idx + 1];
-      if (((new_entry->flags & XTENSA_PROP_INSN) == 0)
-	  || ((new_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) != 0)
-	  || ((the_entry->flags & XTENSA_PROP_ALIGN) != 0))
-	break;
-
-      if (the_entry->address + the_entry->size != new_entry->address)
-	break;
-
-      the_entry = new_entry;
-      ebb->end_ptbl_idx++;
-    }
-
-  /* Quick check for an unreachable or end of file just at the end.  */
-  if (ebb->end_ptbl_idx + 1 == ebb->pte_count)
-    {
-      if (ebb->end_offset == ebb->content_length)
-	ebb->ends_section = TRUE;
-    }
-  else
-    {
-      new_entry = &ebb->ptbl[ebb->end_ptbl_idx + 1];
-      if ((new_entry->flags & XTENSA_PROP_UNREACHABLE) != 0
-	  && the_entry->address + the_entry->size == new_entry->address)
-	ebb->ends_unreachable = new_entry;
-    }
-
-  /* Any other ending requires exact alignment.  */
-  return TRUE;
-}
-
-
-static bfd_boolean
-extend_ebb_bounds_backward (ebb_t *ebb)
-{
-  property_table_entry *the_entry, *new_entry;
-
-  the_entry = &ebb->ptbl[ebb->start_ptbl_idx];
-
-  /* Stop when (1) we cannot decode the instructions in the current entry.
-     (2) we are at the beginning of the property tables, (3) we hit a
-     non-contiguous property table entry, (4) we hit a NO_TRANSFORM region.  */
-
-  while (1)
-    {
-      bfd_vma block_begin;
-      bfd_size_type insn_block_len;
-
-      block_begin = the_entry->address - ebb->sec->vma;
-      insn_block_len =
-	insn_block_decodable_len (ebb->contents, ebb->content_length,
-				  block_begin,
-				  ebb->start_offset - block_begin);
-      if (insn_block_len != ebb->start_offset - block_begin)
-	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
-	     ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
-	  return FALSE;
-	}
-      ebb->start_offset -= insn_block_len;
-
-      /* Update the reloc counter.  */
-      while (ebb->start_reloc_idx > 0
-	     && (ebb->relocs[ebb->start_reloc_idx - 1].r_offset
-		 >= ebb->start_offset))
-	{
-	  ebb->start_reloc_idx--;
-	}
-
-      if (ebb->start_ptbl_idx == 0)
-	return TRUE;
-
-      new_entry = &ebb->ptbl[ebb->start_ptbl_idx - 1];
-      if ((new_entry->flags & XTENSA_PROP_INSN) == 0
-	  || ((new_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) != 0)
-	  || ((new_entry->flags & XTENSA_PROP_ALIGN) != 0))
-	return TRUE;
-      if (new_entry->address + new_entry->size != the_entry->address)
-	return TRUE;
-
-      the_entry = new_entry;
-      ebb->start_ptbl_idx--;
-    }
-  return TRUE;
-}
-
-
-static bfd_size_type
-insn_block_decodable_len (bfd_byte *contents,
-			  bfd_size_type content_len,
-			  bfd_vma block_offset,
-			  bfd_size_type block_len)
-{
-  bfd_vma offset = block_offset;
-
-  while (offset < block_offset + block_len)
-    {
-      bfd_size_type insn_len = 0;
-
-      insn_len = insn_decode_len (contents, content_len, offset);
-      if (insn_len == 0)
-	return (offset - block_offset);
-      offset += insn_len;
-    }
-  return (offset - block_offset);
-}
-
-
-static void
-ebb_propose_action (ebb_constraint *c,
-		    bfd_vma alignment_pow,
-		    enum ebb_target_enum align_type,
-		    text_action_t action,
-		    bfd_vma offset,
-		    int removed_bytes,
-		    bfd_boolean do_action)
-{
-  proposed_action *act;
-
-  if (c->action_allocated <= c->action_count)
-    {
-      unsigned new_allocated, i;
-
-      new_allocated = (c->action_count + 2) * 2;
-      proposed_action *new_actions = (proposed_action *)
-	bfd_zmalloc (sizeof (proposed_action) * new_allocated);
-
-      for (i = 0; i < c->action_count; i++)
-	new_actions[i] = c->actions[i];
-      if (c->actions)
-	free (c->actions);
-      c->actions = new_actions;
-      c->action_allocated = new_allocated;
-    }
-
-  act = &c->actions[c->action_count];
-  act->align_type = align_type;
-  act->alignment_pow = alignment_pow;
-  act->action = action;
-  act->offset = offset;
-  act->removed_bytes = removed_bytes;
-  act->do_action = do_action;
-
-  c->action_count++;
-}
-
 
 /* Access to internal relocations, section contents and symbols.  */
 
@@ -5633,7 +3892,10 @@
    standard BFD functions to take care of this for us.  */
 
 static Elf_Internal_Rela *
-retrieve_internal_relocs (bfd *abfd, asection *sec, bfd_boolean keep_memory)
+retrieve_internal_relocs (abfd, sec, keep_memory)
+     bfd *abfd;
+     asection *sec;
+     bfd_boolean keep_memory;
 {
   Elf_Internal_Rela *internal_relocs;
 
@@ -5643,20 +3905,25 @@
   internal_relocs = elf_section_data (sec)->relocs;
   if (internal_relocs == NULL)
     internal_relocs = (_bfd_elf_link_read_relocs
-		       (abfd, sec, NULL, NULL, keep_memory));
+		       (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+			keep_memory));
   return internal_relocs;
 }
 
 
 static void
-pin_internal_relocs (asection *sec, Elf_Internal_Rela *internal_relocs)
+pin_internal_relocs (sec, internal_relocs)
+     asection *sec;
+     Elf_Internal_Rela *internal_relocs;
 {
   elf_section_data (sec)->relocs = internal_relocs;
 }
 
 
 static void
-release_internal_relocs (asection *sec, Elf_Internal_Rela *internal_relocs)
+release_internal_relocs (sec, internal_relocs)
+     asection *sec;
+     Elf_Internal_Rela *internal_relocs;
 {
   if (internal_relocs
       && elf_section_data (sec)->relocs != internal_relocs)
@@ -5665,19 +3932,20 @@
 
 
 static bfd_byte *
-retrieve_contents (bfd *abfd, asection *sec, bfd_boolean keep_memory)
+retrieve_contents (abfd, sec, keep_memory)
+     bfd *abfd;
+     asection *sec;
+     bfd_boolean keep_memory;
 {
   bfd_byte *contents;
-  bfd_size_type sec_size;
 
-  sec_size = bfd_get_section_limit (abfd, sec);
   contents = elf_section_data (sec)->this_hdr.contents;
   
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       if (!bfd_malloc_and_get_section (abfd, sec, &contents))
 	{
-	  if (contents)
+	  if (contents != NULL)
 	    free (contents);
 	  return NULL;
 	}
@@ -5689,22 +3957,28 @@
 
 
 static void
-pin_contents (asection *sec, bfd_byte *contents)
+pin_contents (sec, contents)
+     asection *sec;
+     bfd_byte *contents;
 {
   elf_section_data (sec)->this_hdr.contents = contents;
 }
 
 
 static void
-release_contents (asection *sec, bfd_byte *contents)
+release_contents (sec, contents)
+     asection *sec;
+     bfd_byte *contents;
 {
-  if (contents && elf_section_data (sec)->this_hdr.contents != contents)
+  if (contents && 
+      elf_section_data (sec)->this_hdr.contents != contents)
     free (contents);
 }
 
 
 static Elf_Internal_Sym *
-retrieve_local_syms (bfd *input_bfd)
+retrieve_local_syms (input_bfd)
+     bfd *input_bfd;
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Sym *isymbuf;
@@ -5728,87 +4002,54 @@
 
 /* Code for link-time relaxation.  */
 
-/* Initialization for relaxation: */
-static bfd_boolean analyze_relocations (struct bfd_link_info *);
+/* Local helper functions.  */
+static bfd_boolean analyze_relocations
+  PARAMS ((struct bfd_link_info *));
 static bfd_boolean find_relaxable_sections
-  (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
+  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
 static bfd_boolean collect_source_relocs
-  (bfd *, asection *, struct bfd_link_info *);
+  PARAMS ((bfd *, asection *, struct bfd_link_info *));
 static bfd_boolean is_resolvable_asm_expansion
-  (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, struct bfd_link_info *,
-   bfd_boolean *);
-static Elf_Internal_Rela *find_associated_l32r_irel
-  (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Rela *);
-static bfd_boolean compute_text_actions
-  (bfd *, asection *, struct bfd_link_info *);
-static bfd_boolean compute_ebb_proposed_actions (ebb_constraint *);
-static bfd_boolean compute_ebb_actions (ebb_constraint *);
-static bfd_boolean check_section_ebb_pcrels_fit
-  (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, const ebb_constraint *);
-static bfd_boolean check_section_ebb_reduces (const ebb_constraint *);
-static void text_action_add_proposed
-  (text_action_list *, const ebb_constraint *, asection *);
-static int compute_fill_extra_space (property_table_entry *);
-
-/* First pass: */
-static bfd_boolean compute_removed_literals
-  (bfd *, asection *, struct bfd_link_info *, value_map_hash_table *);
-static Elf_Internal_Rela *get_irel_at_offset
-  (asection *, Elf_Internal_Rela *, bfd_vma);
-static bfd_boolean is_removable_literal 
-  (const source_reloc *, int, const source_reloc *, int);
-static bfd_boolean remove_dead_literal
-  (bfd *, asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   Elf_Internal_Rela *, source_reloc *, property_table_entry *, int); 
-static bfd_boolean identify_literal_placement
-  (bfd *, asection *, bfd_byte *, struct bfd_link_info *,
-   value_map_hash_table *, bfd_boolean *, Elf_Internal_Rela *, int,
-   source_reloc *, property_table_entry *, int, section_cache_t *,
-   bfd_boolean);
-static bfd_boolean relocations_reach (source_reloc *, int, const r_reloc *);
-static bfd_boolean coalesce_shared_literal
-  (asection *, source_reloc *, property_table_entry *, int, value_map *);
-static bfd_boolean move_shared_literal
-  (asection *, struct bfd_link_info *, source_reloc *, property_table_entry *,
-   int, const r_reloc *, const literal_value *, section_cache_t *);
-
-/* Second pass: */
-static bfd_boolean relax_section (bfd *, asection *, struct bfd_link_info *);
-static bfd_boolean translate_section_fixes (asection *);
-static bfd_boolean translate_reloc_bfd_fix (reloc_bfd_fix *);
-static void translate_reloc (const r_reloc *, r_reloc *);
-static void shrink_dynamic_reloc_sections
-  (struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *);
-static bfd_boolean move_literal
-  (bfd *, struct bfd_link_info *, asection *, bfd_vma, bfd_byte *,
-   xtensa_relax_info *, Elf_Internal_Rela **, const literal_value *);
+  PARAMS ((bfd *, asection *, bfd_byte *, Elf_Internal_Rela *,
+	   struct bfd_link_info *, bfd_boolean *));
+static bfd_boolean remove_literals
+  PARAMS ((bfd *, asection *, struct bfd_link_info *, value_map_hash_table *));
+static bfd_boolean relax_section
+  PARAMS ((bfd *, asection *, struct bfd_link_info *));
 static bfd_boolean relax_property_section
-  (bfd *, asection *, struct bfd_link_info *);
-
-/* Third pass: */
-static bfd_boolean relax_section_symbols (bfd *, asection *);
+  PARAMS ((bfd *, asection *, struct bfd_link_info *));
+static bfd_boolean relax_section_symbols
+  PARAMS ((bfd *, asection *));
+static bfd_boolean relocations_reach
+  PARAMS ((source_reloc *, int, const r_reloc *));
+static void translate_reloc
+  PARAMS ((const r_reloc *, r_reloc *));
+static Elf_Internal_Rela *get_irel_at_offset
+  PARAMS ((asection *, Elf_Internal_Rela *, bfd_vma));
+static Elf_Internal_Rela *find_associated_l32r_irel
+  PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *,
+	   Elf_Internal_Rela *));
+static void shrink_dynamic_reloc_sections
+  PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *));
 
 
 static bfd_boolean 
-elf_xtensa_relax_section (bfd *abfd,
-			  asection *sec,
-			  struct bfd_link_info *link_info,
-			  bfd_boolean *again)
+elf_xtensa_relax_section (abfd, sec, link_info, again)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
+     bfd_boolean *again;
 {
   static value_map_hash_table *values = NULL;
-  static bfd_boolean relocations_analyzed = FALSE;
   xtensa_relax_info *relax_info;
 
-  if (!relocations_analyzed)
+  if (!values)
     {
       /* Do some overall initialization for relaxation.  */
       values = value_map_hash_table_init ();
-      if (values == NULL)
-	return FALSE;
       relaxing_section = TRUE;
       if (!analyze_relocations (link_info))
 	return FALSE;
-      relocations_analyzed = TRUE;
     }
   *again = FALSE;
 
@@ -5825,15 +4066,12 @@
       /* Note: It would be nice to fold this pass into
 	 analyze_relocations, but it is important for this step that the
 	 sections be examined in link order.  */
-      if (!compute_removed_literals (abfd, sec, link_info, values))
+      if (!remove_literals (abfd, sec, link_info, values))
 	return FALSE;
       *again = TRUE;
       break;
 
     case 1:
-      if (values)
-	value_map_hash_table_delete (values);
-      values = NULL;
       if (!relax_section (abfd, sec, link_info))
 	return FALSE;
       *again = TRUE;
@@ -5849,23 +4087,17 @@
   return TRUE;
 }
 
-
 /* Initialization for relaxation.  */
 
 /* This function is called once at the start of relaxation.  It scans
    all the input sections and marks the ones that are relaxable (i.e.,
-   literal sections with L32R relocations against them), and then
-   collects source_reloc information for all the relocations against
-   those relaxable sections.  During this process, it also detects
-   longcalls, i.e., calls relaxed by the assembler into indirect
-   calls, that can be optimized back into direct calls.  Within each
-   extended basic block (ebb) containing an optimized longcall, it
-   computes a set of "text actions" that can be performed to remove
-   the L32R associated with the longcall while optionally preserving
-   branch target alignments.  */
+   literal sections with L32R relocations against them).  It then
+   collect source_reloc information for all the relocations against
+   those relaxable sections.  */
 
 static bfd_boolean
-analyze_relocations (struct bfd_link_info *link_info)
+analyze_relocations (link_info)
+     struct bfd_link_info *link_info;
 {
   bfd *abfd;
   asection *sec;
@@ -5897,8 +4129,7 @@
 	xtensa_relax_info *relax_info;
 
 	relax_info = get_xtensa_relax_info (sec);
-	if (relax_info->is_relaxable_literal_section
-	    || relax_info->is_relaxable_asm_section)
+	if (relax_info->is_relaxable_literal_section)
 	  {
 	    relax_info->src_relocs = (source_reloc *)
 	      bfd_malloc (relax_info->src_count * sizeof (source_reloc));
@@ -5913,39 +4144,31 @@
 	  return FALSE;
       }
 
-  /* Compute the text actions.  */
-  for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next)
-    for (sec = abfd->sections; sec != NULL; sec = sec->next)
-      {
-	if (!compute_text_actions (abfd, sec, link_info))
-	  return FALSE;
-      }
-
   return TRUE;
 }
 
 
-/* Find all the sections that might be relaxed.  The motivation for
-   this pass is that collect_source_relocs() needs to record _all_ the
-   relocations that target each relaxable section.  That is expensive
-   and unnecessary unless the target section is actually going to be
-   relaxed.  This pass identifies all such sections by checking if
+/* Find all the literal sections that might be relaxed.  The motivation
+   for this pass is that collect_source_relocs() needs to record _all_
+   the relocations that target each relaxable section.  That is
+   expensive and unnecessary unless the target section is actually going
+   to be relaxed.  This pass identifies all such sections by checking if
    they have L32Rs pointing to them.  In the process, the total number
    of relocations targeting each section is also counted so that we
    know how much space to allocate for source_relocs against each
    relaxable literal section.  */
 
 static bfd_boolean
-find_relaxable_sections (bfd *abfd,
-			 asection *sec,
-			 struct bfd_link_info *link_info,
-			 bfd_boolean *is_relaxable_p)
+find_relaxable_sections (abfd, sec, link_info, is_relaxable_p)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
+     bfd_boolean *is_relaxable_p;
 {
   Elf_Internal_Rela *internal_relocs;
   bfd_byte *contents;
   bfd_boolean ok = TRUE;
   unsigned i;
-  xtensa_relax_info *source_relax_info;
 
   internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
@@ -5959,7 +4182,6 @@
       goto error_return;
     }
 
-  source_relax_info = get_xtensa_relax_info (sec);
   for (i = 0; i < sec->reloc_count; i++) 
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
@@ -5967,41 +4189,18 @@
       asection *target_sec;
       xtensa_relax_info *target_relax_info;
 
-      /* If this section has not already been marked as "relaxable", and
-	 if it contains any ASM_EXPAND relocations (marking expanded
-	 longcalls) that can be optimized into direct calls, then mark
-	 the section as "relaxable".  */
-      if (source_relax_info
-	  && !source_relax_info->is_relaxable_asm_section
-	  && ELF32_R_TYPE (irel->r_info) == R_XTENSA_ASM_EXPAND)
-	{
-	  bfd_boolean is_reachable = FALSE;
-	  if (is_resolvable_asm_expansion (abfd, sec, contents, irel,
-					   link_info, &is_reachable)
-	      && is_reachable)
-	    {
-	      source_relax_info->is_relaxable_asm_section = TRUE;
-	      *is_relaxable_p = TRUE;
-	    }
-	}
-
-      r_reloc_init (&r_rel, abfd, irel, contents,
-		    bfd_get_section_limit (abfd, sec));
+      r_reloc_init (&r_rel, abfd, irel);
 
       target_sec = r_reloc_get_section (&r_rel);
       target_relax_info = get_xtensa_relax_info (target_sec);
       if (!target_relax_info)
 	continue;
 
-      /* Count PC-relative operand relocations against the target section.
-         Note: The conditions tested here must match the conditions under
-	 which init_source_reloc is called in collect_source_relocs().  */
-      if (is_operand_relocation (ELF32_R_TYPE (irel->r_info))
-	  && (!is_alt_relocation (ELF32_R_TYPE (irel->r_info))
-	      || is_l32r_relocation (abfd, sec, contents, irel)))
-	target_relax_info->src_count++;
+      /* Count relocations against the target section.  */
+      target_relax_info->src_count++;
 
-      if (is_l32r_relocation (abfd, sec, contents, irel)
+      if (is_literal_section (target_sec)
+	  && is_l32r_relocation (sec, contents, irel)
 	  && r_reloc_is_defined (&r_rel))
 	{
 	  /* Mark the target section as relaxable.  */
@@ -6017,29 +4216,28 @@
 }
 
 
-/* Record _all_ the relocations that point to relaxable sections, and
-   get rid of ASM_EXPAND relocs by either converting them to
-   ASM_SIMPLIFY or by removing them.  */
+/* Record _all_ the relocations that point to relaxable literal
+   sections, and get rid of ASM_EXPAND relocs by either converting them
+   to ASM_SIMPLIFY or by removing them.  */
 
 static bfd_boolean
-collect_source_relocs (bfd *abfd,
-		       asection *sec,
-		       struct bfd_link_info *link_info)
+collect_source_relocs (abfd, sec, link_info)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
 {
   Elf_Internal_Rela *internal_relocs;
   bfd_byte *contents;
   bfd_boolean ok = TRUE;
   unsigned i;
-  bfd_size_type sec_size;
 
   internal_relocs = retrieve_internal_relocs (abfd, sec, 
 					      link_info->keep_memory);
   if (internal_relocs == NULL) 
     return ok;
 
-  sec_size = bfd_get_section_limit (abfd, sec);
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       ok = FALSE;
       goto error_return;
@@ -6053,48 +4251,30 @@
       asection *target_sec;
       xtensa_relax_info *target_relax_info;
 
-      r_reloc_init (&r_rel, abfd, irel, contents, sec_size);
+      r_reloc_init (&r_rel, abfd, irel);
 
       target_sec = r_reloc_get_section (&r_rel);
       target_relax_info = get_xtensa_relax_info (target_sec);
 
       if (target_relax_info
-	  && (target_relax_info->is_relaxable_literal_section
-	      || target_relax_info->is_relaxable_asm_section))
+	  && target_relax_info->is_relaxable_literal_section)
 	{
-	  xtensa_opcode opcode = XTENSA_UNDEFINED;
-	  int opnd = -1;
-	  bfd_boolean is_abs_literal = FALSE;
+	  xtensa_opcode opcode;
+	  xtensa_operand opnd;
+	  source_reloc *s_reloc;
+	  int src_next;
 
-	  if (is_alt_relocation (ELF32_R_TYPE (irel->r_info)))
-	    {
-	      /* None of the current alternate relocs are PC-relative,
-		 and only PC-relative relocs matter here.  However, we
-		 still need to record the opcode for literal
-		 coalescing.  */
-	      opcode = get_relocation_opcode (abfd, sec, contents, irel);
-	      if (opcode == get_l32r_opcode ())
-		{
-		  is_abs_literal = TRUE;
-		  opnd = 1;
-		}
-	      else
-		opcode = XTENSA_UNDEFINED;
-	    }
-	  else if (is_operand_relocation (ELF32_R_TYPE (irel->r_info)))
-	    {
-	      opcode = get_relocation_opcode (abfd, sec, contents, irel);
-	      opnd = get_relocation_opnd (opcode, ELF32_R_TYPE (irel->r_info));
-	    }
+	  src_next = target_relax_info->src_next++;
+	  s_reloc = &target_relax_info->src_relocs[src_next];
 
-	  if (opcode != XTENSA_UNDEFINED)
-	    {
-	      int src_next = target_relax_info->src_next++;
-	      source_reloc *s_reloc = &target_relax_info->src_relocs[src_next];
+	  opcode = get_relocation_opcode (sec, contents, irel);
+	  if (opcode == XTENSA_UNDEFINED)
+	    opnd = NULL;
+	  else
+	    opnd = xtensa_get_operand (xtensa_default_isa, opcode,
+				       get_relocation_opnd (irel));
 
-	      init_source_reloc (s_reloc, sec, &r_rel, opcode, opnd,
-				 is_abs_literal);
-	    }
+	  init_source_reloc (s_reloc, sec, &r_rel, opnd);
 	}
     }
 
@@ -6121,21 +4301,20 @@
 	  xtensa_relax_info *target_relax_info;
 
 	  /* Mark the source_reloc for the L32R so that it will be
-	     removed in compute_removed_literals(), along with the
-	     associated literal.  */
-	  l32r_irel = find_associated_l32r_irel (abfd, sec, contents,
+	     removed in remove_literals(), along with the associated
+	     literal.  */
+	  l32r_irel = find_associated_l32r_irel (sec, contents,
 						 irel, internal_relocs);
 	  if (l32r_irel == NULL)
 	    continue;
 
-	  r_reloc_init (&r_rel, abfd, l32r_irel, contents, sec_size);
+	  r_reloc_init (&r_rel, abfd, l32r_irel);
 
 	  target_sec = r_reloc_get_section (&r_rel);
 	  target_relax_info = get_xtensa_relax_info (target_sec);
 
 	  if (target_relax_info
-	      && (target_relax_info->is_relaxable_literal_section
-		  || target_relax_info->is_relaxable_asm_section))
+	      && target_relax_info->is_relaxable_literal_section)
 	    {
 	      source_reloc *s_reloc;
 
@@ -6181,12 +4360,14 @@
    for this section and the target section.  */
 
 bfd_boolean
-is_resolvable_asm_expansion (bfd *abfd,
-			     asection *sec,
-			     bfd_byte *contents,
-			     Elf_Internal_Rela *irel,
-			     struct bfd_link_info *link_info,
-			     bfd_boolean *is_reachable_p)
+is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info,
+			     is_reachable_p)
+     bfd *abfd;
+     asection *sec;
+     bfd_byte *contents;
+     Elf_Internal_Rela *irel;
+     struct bfd_link_info *link_info;
+     bfd_boolean *is_reachable_p;
 {
   asection *target_sec;
   bfd_vma target_offset;
@@ -6194,8 +4375,6 @@
   xtensa_opcode opcode, direct_call_opcode;
   bfd_vma self_address;
   bfd_vma dest_address;
-  bfd_boolean uses_l32r;
-  bfd_size_type sec_size;
 
   *is_reachable_p = FALSE;
 
@@ -6204,25 +4383,21 @@
 
   if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_EXPAND) 
     return FALSE;
-
-  sec_size = bfd_get_section_limit (abfd, sec);
+  
   opcode = get_expanded_call_opcode (contents + irel->r_offset,
-				     sec_size - irel->r_offset, &uses_l32r);
-  /* Optimization of longcalls that use CONST16 is not yet implemented.  */
-  if (!uses_l32r)
-    return FALSE;
+				     sec->size - irel->r_offset);
   
   direct_call_opcode = swap_callx_for_call_opcode (opcode);
   if (direct_call_opcode == XTENSA_UNDEFINED)
     return FALSE;
 
   /* Check and see that the target resolves.  */
-  r_reloc_init (&r_rel, abfd, irel, contents, sec_size);
+  r_reloc_init (&r_rel, abfd, irel);
   if (!r_reloc_is_defined (&r_rel))
     return FALSE;
 
   target_sec = r_reloc_get_section (&r_rel);
-  target_offset = r_rel.target_offset;
+  target_offset = r_reloc_get_target_offset (&r_rel);
 
   /* If the target is in a shared library, then it doesn't reach.  This
      isn't supposed to come up because the compiler should never generate
@@ -6235,8 +4410,7 @@
      section of the target is the same as the output section of the
      source.  */
   if (link_info->relocatable
-      && (target_sec->output_section != sec->output_section
-	  || is_reloc_sym_weak (abfd, irel)))
+      && (target_sec->output_section != sec->output_section))
     return FALSE;
 
   self_address = (sec->output_section->vma
@@ -6244,8 +4418,9 @@
   dest_address = (target_sec->output_section->vma
 		  + target_sec->output_offset + target_offset);
       
-  *is_reachable_p = pcrel_reloc_fits (direct_call_opcode, 0,
-				      self_address, dest_address);
+  *is_reachable_p = pcrel_reloc_fits
+    (xtensa_get_operand (xtensa_default_isa, direct_call_opcode, 0),
+     self_address, dest_address);
 
   if ((self_address >> CALL_SEGMENT_BITS) !=
       (dest_address >> CALL_SEGMENT_BITS))
@@ -6256,11 +4431,11 @@
 
 
 static Elf_Internal_Rela *
-find_associated_l32r_irel (bfd *abfd,
-			   asection *sec,
-			   bfd_byte *contents,
-			   Elf_Internal_Rela *other_irel,
-			   Elf_Internal_Rela *internal_relocs)
+find_associated_l32r_irel (sec, contents, other_irel, internal_relocs)
+     asection *sec;
+     bfd_byte *contents;
+     Elf_Internal_Rela *other_irel;
+     Elf_Internal_Rela *internal_relocs;
 {
   unsigned i;
 
@@ -6272,1142 +4447,140 @@
 	continue;
       if (irel->r_offset != other_irel->r_offset)
 	continue;
-      if (is_l32r_relocation (abfd, sec, contents, irel))
+      if (is_l32r_relocation (sec, contents, irel))
 	return irel;
     }
 
   return NULL;
 }
 
-
-/* The compute_text_actions function will build a list of potential
-   transformation actions for code in the extended basic block of each
-   longcall that is optimized to a direct call.  From this list we
-   generate a set of actions to actually perform that optimizes for
-   space and, if not using size_opt, maintains branch target
-   alignments.
-
-   These actions to be performed are placed on a per-section list.
-   The actual changes are performed by relax_section() in the second
-   pass.  */
-
-bfd_boolean
-compute_text_actions (bfd *abfd,
-		      asection *sec,
-		      struct bfd_link_info *link_info)
-{
-  xtensa_relax_info *relax_info;
-  bfd_byte *contents;
-  Elf_Internal_Rela *internal_relocs;
-  bfd_boolean ok = TRUE;
-  unsigned i;
-  property_table_entry *prop_table = 0;
-  int ptblsize = 0;
-  bfd_size_type sec_size;
-  static bfd_boolean no_insn_move = FALSE;
-
-  if (no_insn_move)
-    return ok;
-
-  /* Do nothing if the section contains no optimized longcalls.  */
-  relax_info = get_xtensa_relax_info (sec);
-  BFD_ASSERT (relax_info);
-  if (!relax_info->is_relaxable_asm_section)
-    return ok;
-
-  internal_relocs = retrieve_internal_relocs (abfd, sec,
-					      link_info->keep_memory);
-
-  if (internal_relocs)
-    qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela),
-	   internal_reloc_compare);
-
-  sec_size = bfd_get_section_limit (abfd, sec);
-  contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
-    {
-      ok = FALSE;
-      goto error_return;
-    }
-
-  ptblsize = xtensa_read_table_entries (abfd, sec, &prop_table,
-					XTENSA_PROP_SEC_NAME, FALSE);
-  if (ptblsize < 0)
-    {
-      ok = FALSE;
-      goto error_return;
-    }
-
-  for (i = 0; i < sec->reloc_count; i++)
-    {
-      Elf_Internal_Rela *irel = &internal_relocs[i];
-      bfd_vma r_offset;
-      property_table_entry *the_entry;
-      int ptbl_idx;
-      ebb_t *ebb;
-      ebb_constraint ebb_table;
-      bfd_size_type simplify_size;
-
-      if (irel && ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_SIMPLIFY)
-	continue;
-      r_offset = irel->r_offset;
-
-      simplify_size = get_asm_simplify_size (contents, sec_size, r_offset);
-      if (simplify_size == 0)
-	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY relocation; possible configuration mismatch"),
-	     sec->owner, sec, r_offset);
-	  continue;
-	}
-
-      /* If the instruction table is not around, then don't do this
-	 relaxation.  */
-      the_entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
-						  sec->vma + irel->r_offset);
-      if (the_entry == NULL || XTENSA_NO_NOP_REMOVAL)
-	{
-	  text_action_add (&relax_info->action_list,
-			   ta_convert_longcall, sec, r_offset,
-			   0);
-	  continue;
-	}
-
-      /* If the next longcall happens to be at the same address as an
-	 unreachable section of size 0, then skip forward.  */
-      ptbl_idx = the_entry - prop_table;
-      while ((the_entry->flags & XTENSA_PROP_UNREACHABLE)
-	     && the_entry->size == 0
-	     && ptbl_idx + 1 < ptblsize
-	     && (prop_table[ptbl_idx + 1].address
-		 == prop_table[ptbl_idx].address))
-	{
-	  ptbl_idx++;
-	  the_entry++;
-	}
-
-      if (the_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM)
-	  /* NO_REORDER is OK */
-	continue;
-
-      init_ebb_constraint (&ebb_table);
-      ebb = &ebb_table.ebb;
-      init_ebb (ebb, sec, contents, sec_size, prop_table, ptblsize,
-		internal_relocs, sec->reloc_count);
-      ebb->start_offset = r_offset + simplify_size;
-      ebb->end_offset = r_offset + simplify_size;
-      ebb->start_ptbl_idx = ptbl_idx;
-      ebb->end_ptbl_idx = ptbl_idx;
-      ebb->start_reloc_idx = i;
-      ebb->end_reloc_idx = i;
-
-      if (!extend_ebb_bounds (ebb)
-	  || !compute_ebb_proposed_actions (&ebb_table)
-	  || !compute_ebb_actions (&ebb_table)
-	  || !check_section_ebb_pcrels_fit (abfd, sec, contents,
-					    internal_relocs, &ebb_table)
-	  || !check_section_ebb_reduces (&ebb_table))
-	{
-	  /* If anything goes wrong or we get unlucky and something does
-	     not fit, with our plan because of expansion between
-	     critical branches, just convert to a NOP.  */
-
-	  text_action_add (&relax_info->action_list,
-			   ta_convert_longcall, sec, r_offset, 0);
-	  i = ebb_table.ebb.end_reloc_idx;
-	  free_ebb_constraint (&ebb_table);
-	  continue;
-	}
-
-      text_action_add_proposed (&relax_info->action_list, &ebb_table, sec);
-
-      /* Update the index so we do not go looking at the relocations
-	 we have already processed.  */
-      i = ebb_table.ebb.end_reloc_idx;
-      free_ebb_constraint (&ebb_table);
-    }
-
-#if DEBUG
-  if (relax_info->action_list.head)
-    print_action_list (stderr, &relax_info->action_list);
-#endif
-
-error_return:
-  release_contents (sec, contents);
-  release_internal_relocs (sec, internal_relocs);
-  if (prop_table)
-    free (prop_table);
-
-  return ok;
-}
-
-
-/* Find all of the possible actions for an extended basic block.  */
-
-bfd_boolean
-compute_ebb_proposed_actions (ebb_constraint *ebb_table)
-{
-  const ebb_t *ebb = &ebb_table->ebb;
-  unsigned rel_idx = ebb->start_reloc_idx;
-  property_table_entry *entry, *start_entry, *end_entry;
-
-  start_entry = &ebb->ptbl[ebb->start_ptbl_idx];
-  end_entry = &ebb->ptbl[ebb->end_ptbl_idx];
-
-  for (entry = start_entry; entry <= end_entry; entry++)
-    {
-      bfd_vma offset, start_offset, end_offset;
-      bfd_size_type insn_len;
-
-      start_offset = entry->address - ebb->sec->vma;
-      end_offset = entry->address + entry->size - ebb->sec->vma;
-
-      if (entry == start_entry)
-	start_offset = ebb->start_offset;
-      if (entry == end_entry)
-	end_offset = ebb->end_offset;
-      offset = start_offset;
-
-      if (offset == entry->address - ebb->sec->vma
-	  && (entry->flags & XTENSA_PROP_INSN_BRANCH_TARGET) != 0)
-	{
-	  enum ebb_target_enum align_type = EBB_DESIRE_TGT_ALIGN;
-	  BFD_ASSERT (offset != end_offset);
-	  if (offset == end_offset)
-	    return FALSE;
-
-	  insn_len = insn_decode_len (ebb->contents, ebb->content_length,
-				      offset);
-
-	  /* Propose no actions for a section with an undecodable offset.  */
-	  if (insn_len == 0) 
-	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
-		 ebb->sec->owner, ebb->sec, offset);
-	      return FALSE;
-	    }
-	  if (check_branch_target_aligned_address (offset, insn_len))
-	    align_type = EBB_REQUIRE_TGT_ALIGN;
-
-	  ebb_propose_action (ebb_table, align_type, 0,
-			      ta_none, offset, 0, TRUE);
-	}
-
-      while (offset != end_offset)
-	{
-	  Elf_Internal_Rela *irel;
-	  xtensa_opcode opcode;
-
-	  while (rel_idx < ebb->end_reloc_idx
-		 && (ebb->relocs[rel_idx].r_offset < offset
-		     || (ebb->relocs[rel_idx].r_offset == offset
-			 && (ELF32_R_TYPE (ebb->relocs[rel_idx].r_info)
-			     != R_XTENSA_ASM_SIMPLIFY))))
-	    rel_idx++;
-
-	  /* Check for longcall.  */
-	  irel = &ebb->relocs[rel_idx];
-	  if (irel->r_offset == offset
-	      && ELF32_R_TYPE (irel->r_info) == R_XTENSA_ASM_SIMPLIFY)
-	    {
-	      bfd_size_type simplify_size;
-
-	      simplify_size = get_asm_simplify_size (ebb->contents, 
-						     ebb->content_length,
-						     irel->r_offset);
-	      if (simplify_size == 0)
-		{
-		  (*_bfd_error_handler)
-		    (_("%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY relocation; possible configuration mismatch"),
-		     ebb->sec->owner, ebb->sec, offset);
-		  return FALSE;
-		}
-
-	      ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
-				  ta_convert_longcall, offset, 0, TRUE);
-	      
-	      offset += simplify_size;
-	      continue;
-	    }
-
-	  insn_len = insn_decode_len (ebb->contents, ebb->content_length,
-				      offset);
-	  /* If the instruction is undecodable, then report an error.  */
-	  if (insn_len == 0)
-	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
-		 ebb->sec->owner, ebb->sec, offset);
-	      return FALSE;
-	    }
-	    
-	  if ((entry->flags & XTENSA_PROP_INSN_NO_DENSITY) == 0
-	      && (entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) == 0
-	      && narrow_instruction (ebb->contents, ebb->content_length,
-				     offset, FALSE))
-	    {
-	      /* Add an instruction narrow action.  */
-	      ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
-				  ta_narrow_insn, offset, 0, FALSE);
-	      offset += insn_len;
-	      continue;
-	    }
-	  if ((entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) == 0
-	      && widen_instruction (ebb->contents, ebb->content_length,
-				    offset, FALSE))
-	    {
-	      /* Add an instruction widen action.  */
-	      ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
-				  ta_widen_insn, offset, 0, FALSE);
-	      offset += insn_len;
-	      continue;
-	    }
-	  opcode = insn_decode_opcode (ebb->contents, ebb->content_length,
-				       offset, 0);
-	  if (xtensa_opcode_is_loop (xtensa_default_isa, opcode))
-	    {
-	      /* Check for branch targets.  */
-	      ebb_propose_action (ebb_table, EBB_REQUIRE_LOOP_ALIGN, 0,
-				  ta_none, offset, 0, TRUE);
-	      offset += insn_len;
-	      continue;
-	    }
-
-	  offset += insn_len;
-	}
-    }
-
-  if (ebb->ends_unreachable)
-    {
-      ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
-			  ta_fill, ebb->end_offset, 0, TRUE);
-    }
-
-  return TRUE;
-}
-
-
-/* After all of the information has collected about the
-   transformations possible in an EBB, compute the appropriate actions
-   here in compute_ebb_actions.  We still must check later to make
-   sure that the actions do not break any relocations.  The algorithm
-   used here is pretty greedy.  Basically, it removes as many no-ops
-   as possible so that the end of the EBB has the same alignment
-   characteristics as the original.  First, it uses narrowing, then
-   fill space at the end of the EBB, and finally widenings.  If that
-   does not work, it tries again with one fewer no-op removed.  The
-   optimization will only be performed if all of the branch targets
-   that were aligned before transformation are also aligned after the
-   transformation.
-
-   When the size_opt flag is set, ignore the branch target alignments,
-   narrow all wide instructions, and remove all no-ops unless the end
-   of the EBB prevents it.  */
-
-bfd_boolean
-compute_ebb_actions (ebb_constraint *ebb_table)
-{
-  unsigned i = 0;
-  unsigned j;
-  int removed_bytes = 0;
-  ebb_t *ebb = &ebb_table->ebb;
-  unsigned seg_idx_start = 0;
-  unsigned seg_idx_end = 0;
-
-  /* We perform this like the assembler relaxation algorithm: Start by
-     assuming all instructions are narrow and all no-ops removed; then
-     walk through....  */
-
-  /* For each segment of this that has a solid constraint, check to
-     see if there are any combinations that will keep the constraint.
-     If so, use it.  */
-  for (seg_idx_end = 0; seg_idx_end < ebb_table->action_count; seg_idx_end++)
-    {
-      bfd_boolean requires_text_end_align = FALSE;
-      unsigned longcall_count = 0;
-      unsigned longcall_convert_count = 0;
-      unsigned narrowable_count = 0;
-      unsigned narrowable_convert_count = 0;
-      unsigned widenable_count = 0;
-      unsigned widenable_convert_count = 0;
-
-      proposed_action *action = NULL;
-      int align = (1 << ebb_table->ebb.sec->alignment_power);
-
-      seg_idx_start = seg_idx_end;
-
-      for (i = seg_idx_start; i < ebb_table->action_count; i++)
-	{
-	  action = &ebb_table->actions[i];
-	  if (action->action == ta_convert_longcall)
-	    longcall_count++;
-	  if (action->action == ta_narrow_insn)
-	    narrowable_count++;
-	  if (action->action == ta_widen_insn)
-	    widenable_count++;
-	  if (action->action == ta_fill)
-	    break;
-	  if (action->align_type == EBB_REQUIRE_LOOP_ALIGN)
-	    break;
-	  if (action->align_type == EBB_REQUIRE_TGT_ALIGN
-	      && !elf32xtensa_size_opt)
-	    break;
-	}
-      seg_idx_end = i;
-
-      if (seg_idx_end == ebb_table->action_count && !ebb->ends_unreachable)
-	requires_text_end_align = TRUE;
-
-      if (elf32xtensa_size_opt && !requires_text_end_align
-	  && action->align_type != EBB_REQUIRE_LOOP_ALIGN
-	  && action->align_type != EBB_REQUIRE_TGT_ALIGN)
-	{
-	  longcall_convert_count = longcall_count;
-	  narrowable_convert_count = narrowable_count;
-	  widenable_convert_count = 0;
-	}
-      else
-	{
-	  /* There is a constraint.  Convert the max number of longcalls.  */
-	  narrowable_convert_count = 0;
-	  longcall_convert_count = 0;
-	  widenable_convert_count = 0;
-
-	  for (j = 0; j < longcall_count; j++)
-	    {
-	      int removed = (longcall_count - j) * 3 & (align - 1);
-	      unsigned desire_narrow = (align - removed) & (align - 1);
-	      unsigned desire_widen = removed;
-	      if (desire_narrow <= narrowable_count)
-		{
-		  narrowable_convert_count = desire_narrow;
-		  narrowable_convert_count +=
-		    (align * ((narrowable_count - narrowable_convert_count)
-			      / align));
-		  longcall_convert_count = (longcall_count - j);
-		  widenable_convert_count = 0;
-		  break;
-		}
-	      if (desire_widen <= widenable_count && !elf32xtensa_size_opt)
-		{
-		  narrowable_convert_count = 0;
-		  longcall_convert_count = longcall_count - j;
-		  widenable_convert_count = desire_widen;
-		  break;
-		}
-	    }
-	}
-
-      /* Now the number of conversions are saved.  Do them.  */
-      for (i = seg_idx_start; i < seg_idx_end; i++)
-	{
-	  action = &ebb_table->actions[i];
-	  switch (action->action)
-	    {
-	    case ta_convert_longcall:
-	      if (longcall_convert_count != 0)
-		{
-		  action->action = ta_remove_longcall;
-		  action->do_action = TRUE;
-		  action->removed_bytes += 3;
-		  longcall_convert_count--;
-		}
-	      break;
-	    case ta_narrow_insn:
-	      if (narrowable_convert_count != 0)
-		{
-		  action->do_action = TRUE;
-		  action->removed_bytes += 1;
-		  narrowable_convert_count--;
-		}
-	      break;
-	    case ta_widen_insn:
-	      if (widenable_convert_count != 0)
-		{
-		  action->do_action = TRUE;
-		  action->removed_bytes -= 1;
-		  widenable_convert_count--;
-		}
-	      break;
-	    default:
-	      break;
-	    }
-	}
-    }
-
-  /* Now we move on to some local opts.  Try to remove each of the
-     remaining longcalls.  */
-
-  if (ebb_table->ebb.ends_section || ebb_table->ebb.ends_unreachable)
-    {
-      removed_bytes = 0;
-      for (i = 0; i < ebb_table->action_count; i++)
-	{
-	  int old_removed_bytes = removed_bytes;
-	  proposed_action *action = &ebb_table->actions[i];
-
-	  if (action->do_action && action->action == ta_convert_longcall)
-	    {
-	      bfd_boolean bad_alignment = FALSE;
-	      removed_bytes += 3;
-	      for (j = i + 1; j < ebb_table->action_count; j++)
-		{
-		  proposed_action *new_action = &ebb_table->actions[j];
-		  bfd_vma offset = new_action->offset;
-		  if (new_action->align_type == EBB_REQUIRE_TGT_ALIGN)
-		    {
-		      if (!check_branch_target_aligned
-			  (ebb_table->ebb.contents,
-			   ebb_table->ebb.content_length,
-			   offset, offset - removed_bytes))
-			{
-			  bad_alignment = TRUE;
-			  break;
-			}
-		    }
-		  if (new_action->align_type == EBB_REQUIRE_LOOP_ALIGN)
-		    {
-		      if (!check_loop_aligned (ebb_table->ebb.contents,
-					       ebb_table->ebb.content_length,
-					       offset,
-					       offset - removed_bytes))
-			{
-			  bad_alignment = TRUE;
-			  break;
-			}
-		    }
-		  if (new_action->action == ta_narrow_insn
-		      && !new_action->do_action
-		      && ebb_table->ebb.sec->alignment_power == 2)
-		    {
-		      /* Narrow an instruction and we are done.  */
-		      new_action->do_action = TRUE;
-		      new_action->removed_bytes += 1;
-		      bad_alignment = FALSE;
-		      break;
-		    }
-		  if (new_action->action == ta_widen_insn
-		      && new_action->do_action
-		      && ebb_table->ebb.sec->alignment_power == 2)
-		    {
-		      /* Narrow an instruction and we are done.  */
-		      new_action->do_action = FALSE;
-		      new_action->removed_bytes += 1;
-		      bad_alignment = FALSE;
-		      break;
-		    }
-		}
-	      if (!bad_alignment)
-		{
-		  action->removed_bytes += 3;
-		  action->action = ta_remove_longcall;
-		  action->do_action = TRUE;
-		}
-	    }
-	  removed_bytes = old_removed_bytes;
-	  if (action->do_action)
-	    removed_bytes += action->removed_bytes;
-	}
-    }
-
-  removed_bytes = 0;
-  for (i = 0; i < ebb_table->action_count; ++i)
-    {
-      proposed_action *action = &ebb_table->actions[i];
-      if (action->do_action)
-	removed_bytes += action->removed_bytes;
-    }
-
-  if ((removed_bytes % (1 << ebb_table->ebb.sec->alignment_power)) != 0
-      && ebb->ends_unreachable)
-    {
-      proposed_action *action;
-      int br;
-      int extra_space;
-
-      BFD_ASSERT (ebb_table->action_count != 0);
-      action = &ebb_table->actions[ebb_table->action_count - 1];
-      BFD_ASSERT (action->action == ta_fill);
-      BFD_ASSERT (ebb->ends_unreachable->flags & XTENSA_PROP_UNREACHABLE);
-
-      extra_space = compute_fill_extra_space (ebb->ends_unreachable);
-      br = action->removed_bytes + removed_bytes + extra_space;
-      br = br & ((1 << ebb->sec->alignment_power ) - 1);
-
-      action->removed_bytes = extra_space - br;
-    }
-  return TRUE;
-}
-
-
-/* Use check_section_ebb_pcrels_fit to make sure that all of the
-   relocations in a section will fit if a proposed set of actions
-   are performed.  */
-
-static bfd_boolean
-check_section_ebb_pcrels_fit (bfd *abfd,
-			      asection *sec,
-			      bfd_byte *contents,
-			      Elf_Internal_Rela *internal_relocs,
-			      const ebb_constraint *constraint)
-{
-  unsigned i, j;
-  Elf_Internal_Rela *irel;
-  xtensa_relax_info *relax_info;
-
-  relax_info = get_xtensa_relax_info (sec);
-
-  for (i = 0; i < sec->reloc_count; i++)
-    {
-      r_reloc r_rel;
-      bfd_vma orig_self_offset, orig_target_offset;
-      bfd_vma self_offset, target_offset;
-      int r_type;
-      reloc_howto_type *howto;
-      int self_removed_bytes, target_removed_bytes;
-
-      irel = &internal_relocs[i];
-      r_type = ELF32_R_TYPE (irel->r_info);
-
-      howto = &elf_howto_table[r_type];
-      /* We maintain the required invariant: PC-relative relocations
-	 that fit before linking must fit after linking.  Thus we only
-	 need to deal with relocations to the same section that are
-	 PC-relative.  */
-      if (ELF32_R_TYPE (irel->r_info) == R_XTENSA_ASM_SIMPLIFY
-	  || !howto->pc_relative)
-	continue;
-
-      r_reloc_init (&r_rel, abfd, irel, contents,
-		    bfd_get_section_limit (abfd, sec));
-
-      if (r_reloc_get_section (&r_rel) != sec)
-	continue;
-
-      orig_self_offset = irel->r_offset;
-      orig_target_offset = r_rel.target_offset;
-
-      self_offset = orig_self_offset;
-      target_offset = orig_target_offset;
-
-      if (relax_info)
-	{
-	  self_offset = offset_with_removed_text (&relax_info->action_list,
-						  orig_self_offset);
-	  target_offset = offset_with_removed_text (&relax_info->action_list,
-						    orig_target_offset);
-	}
-
-      self_removed_bytes = 0;
-      target_removed_bytes = 0;
-
-      for (j = 0; j < constraint->action_count; ++j)
-	{
-	  proposed_action *action = &constraint->actions[j];
-	  bfd_vma offset = action->offset;
-	  int removed_bytes = action->removed_bytes;
-	  if (offset < orig_self_offset
-	      || (offset == orig_self_offset && action->action == ta_fill
-		  && action->removed_bytes < 0))
-	    self_removed_bytes += removed_bytes;
-	  if (offset < orig_target_offset
-	      || (offset == orig_target_offset && action->action == ta_fill
-		  && action->removed_bytes < 0))
-	    target_removed_bytes += removed_bytes;
-	}
-      self_offset -= self_removed_bytes;
-      target_offset -= target_removed_bytes;
-
-      /* Try to encode it.  Get the operand and check.  */
-      if (is_alt_relocation (ELF32_R_TYPE (irel->r_info)))
-	{
-	  /* None of the current alternate relocs are PC-relative,
-	     and only PC-relative relocs matter here.  */
-	}
-      else
-	{
-	  xtensa_opcode opcode;
-	  int opnum;
-
-	  opcode = get_relocation_opcode (abfd, sec, contents, irel);
-	  if (opcode == XTENSA_UNDEFINED)
-	    return FALSE;
-
-	  opnum = get_relocation_opnd (opcode, ELF32_R_TYPE (irel->r_info));
-	  if (opnum == XTENSA_UNDEFINED)
-	    return FALSE;
-
-	  if (!pcrel_reloc_fits (opcode, opnum, self_offset, target_offset))
-	    return FALSE;
-	}
-    }
-
-  return TRUE;
-}
-
-
-static bfd_boolean
-check_section_ebb_reduces (const ebb_constraint *constraint)
-{
-  int removed = 0;
-  unsigned i;
-
-  for (i = 0; i < constraint->action_count; i++)
-    {
-      const proposed_action *action = &constraint->actions[i];
-      if (action->do_action)
-	removed += action->removed_bytes;
-    }
-  if (removed < 0)
-    return FALSE;
-
-  return TRUE;
-}
-
-
-void
-text_action_add_proposed (text_action_list *l,
-			  const ebb_constraint *ebb_table,
-			  asection *sec)
-{
-  unsigned i;
-
-  for (i = 0; i < ebb_table->action_count; i++)
-    {
-      proposed_action *action = &ebb_table->actions[i];
-
-      if (!action->do_action)
-	continue;
-      switch (action->action)
-	{
-	case ta_remove_insn:
-	case ta_remove_longcall:
-	case ta_convert_longcall:
-	case ta_narrow_insn:
-	case ta_widen_insn:
-	case ta_fill:
-	case ta_remove_literal:
-	  text_action_add (l, action->action, sec, action->offset,
-			   action->removed_bytes);
-	  break;
-	case ta_none:
-	  break;
-	default:
-	  BFD_ASSERT (0);
-	  break;
-	}
-    }
-}
-
-
-int
-compute_fill_extra_space (property_table_entry *entry)
-{
-  int fill_extra_space;
-
-  if (!entry)
-    return 0;
-
-  if ((entry->flags & XTENSA_PROP_UNREACHABLE) == 0)
-    return 0;
-
-  fill_extra_space = entry->size;
-  if ((entry->flags & XTENSA_PROP_ALIGN) != 0)
-    {
-      /* Fill bytes for alignment:
-	 (2**n)-1 - (addr + (2**n)-1) & (2**n -1) */
-      int pow = GET_XTENSA_PROP_ALIGNMENT (entry->flags);
-      int nsm = (1 << pow) - 1;
-      bfd_vma addr = entry->address + entry->size;
-      bfd_vma align_fill = nsm - ((addr + nsm) & nsm);
-      fill_extra_space += align_fill;
-    }
-  return fill_extra_space;
-}
-
-
 /* First relaxation pass.  */
 
-/* If the section contains relaxable literals, check each literal to
-   see if it has the same value as another literal that has already
-   been seen, either in the current section or a previous one.  If so,
-   add an entry to the per-section list of removed literals.  The
+/* If the section is relaxable (i.e., a literal section), check each
+   literal to see if it has the same value as another literal that has
+   already been seen, either in the current section or a previous one.
+   If so, add an entry to the per-section list of removed literals.  The
    actual changes are deferred until the next pass.  */
 
 static bfd_boolean 
-compute_removed_literals (bfd *abfd,
-			  asection *sec,
-			  struct bfd_link_info *link_info,
-			  value_map_hash_table *values)
+remove_literals (abfd, sec, link_info, values)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
+     value_map_hash_table *values;
 {
   xtensa_relax_info *relax_info;
   bfd_byte *contents;
   Elf_Internal_Rela *internal_relocs;
-  source_reloc *src_relocs, *rel;
+  source_reloc *src_relocs;
+  bfd_boolean final_static_link;
   bfd_boolean ok = TRUE;
-  property_table_entry *prop_table = NULL;
-  int ptblsize;
-  int i, prev_i;
-  bfd_boolean last_loc_is_prev = FALSE;
-  bfd_vma last_target_offset = 0;
-  section_cache_t target_sec_cache;
-  bfd_size_type sec_size;
-
-  init_section_cache (&target_sec_cache);
+  int i;
 
   /* Do nothing if it is not a relaxable literal section.  */
   relax_info = get_xtensa_relax_info (sec);
   BFD_ASSERT (relax_info);
+
   if (!relax_info->is_relaxable_literal_section)
     return ok;
 
   internal_relocs = retrieve_internal_relocs (abfd, sec, 
 					      link_info->keep_memory);
 
-  sec_size = bfd_get_section_limit (abfd, sec);
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       ok = FALSE;
       goto error_return;
     }
 
-  /* Sort the source_relocs by target offset.  */
-  src_relocs = relax_info->src_relocs;
-  qsort (src_relocs, relax_info->src_count,
-	 sizeof (source_reloc), source_reloc_compare);
-  qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela),
-	 internal_reloc_compare);
-
-  ptblsize = xtensa_read_table_entries (abfd, sec, &prop_table,
-					XTENSA_PROP_SEC_NAME, FALSE);
-  if (ptblsize < 0)
-    {
-      ok = FALSE;
-      goto error_return;
-    }
-
-  prev_i = -1;
-  for (i = 0; i < relax_info->src_count; i++)
-    {
-      Elf_Internal_Rela *irel = NULL;
-
-      rel = &src_relocs[i];
-      if (get_l32r_opcode () != rel->opcode)
-	continue;
-      irel = get_irel_at_offset (sec, internal_relocs,
-				 rel->r_rel.target_offset);
-
-      /* If the relocation on this is not a simple R_XTENSA_32 or
-	 R_XTENSA_PLT then do not consider it.  This may happen when
-	 the difference of two symbols is used in a literal.  */
-      if (irel && (ELF32_R_TYPE (irel->r_info) != R_XTENSA_32
-		   && ELF32_R_TYPE (irel->r_info) != R_XTENSA_PLT))
-	continue;
-
-      /* If the target_offset for this relocation is the same as the
-	 previous relocation, then we've already considered whether the
-	 literal can be coalesced.  Skip to the next one....  */
-      if (i != 0 && prev_i != -1
-	  && src_relocs[i-1].r_rel.target_offset == rel->r_rel.target_offset)
-	continue;
-      prev_i = i;
-
-      if (last_loc_is_prev && 
-	  last_target_offset + 4 != rel->r_rel.target_offset)
-	last_loc_is_prev = FALSE;
-
-      /* Check if the relocation was from an L32R that is being removed
-	 because a CALLX was converted to a direct CALL, and check if
-	 there are no other relocations to the literal.  */
-      if (is_removable_literal (rel, i, src_relocs, relax_info->src_count))
-	{
-	  if (!remove_dead_literal (abfd, sec, link_info, internal_relocs,
-				    irel, rel, prop_table, ptblsize))
-	    {
-	      ok = FALSE;
-	      goto error_return;
-	    }
-	  last_target_offset = rel->r_rel.target_offset;
-	  continue;
-	}
-
-      if (!identify_literal_placement (abfd, sec, contents, link_info,
-				       values, 
-				       &last_loc_is_prev, irel, 
-				       relax_info->src_count - i, rel,
-				       prop_table, ptblsize,
-				       &target_sec_cache, rel->is_abs_literal))
-	{
-	  ok = FALSE;
-	  goto error_return;
-	}
-      last_target_offset = rel->r_rel.target_offset;
-    }
-
-#if DEBUG
-  print_removed_literals (stderr, &relax_info->removed_list);
-  print_action_list (stderr, &relax_info->action_list);
-#endif /* DEBUG */
-
-error_return:
-  if (prop_table) free (prop_table);
-  clear_section_cache (&target_sec_cache);
-
-  release_contents (sec, contents);
-  release_internal_relocs (sec, internal_relocs);
-  return ok;
-}
-
-
-static Elf_Internal_Rela *
-get_irel_at_offset (asection *sec,
-		    Elf_Internal_Rela *internal_relocs,
-		    bfd_vma offset)
-{
-  unsigned i;
-  Elf_Internal_Rela *irel;
-  unsigned r_type;
-  Elf_Internal_Rela key;
-
-  if (!internal_relocs) 
-    return NULL;
-
-  key.r_offset = offset;
-  irel = bsearch (&key, internal_relocs, sec->reloc_count,
-		  sizeof (Elf_Internal_Rela), internal_reloc_matches);
-  if (!irel)
-    return NULL;
-
-  /* bsearch does not guarantee which will be returned if there are
-     multiple matches.  We need the first that is not an alignment.  */
-  i = irel - internal_relocs;
-  while (i > 0)
-    {
-      if (internal_relocs[i-1].r_offset != offset)
-	break;
-      i--;
-    }
-  for ( ; i < sec->reloc_count; i++)
-    {
-      irel = &internal_relocs[i];
-      r_type = ELF32_R_TYPE (irel->r_info);
-      if (irel->r_offset == offset && r_type != R_XTENSA_NONE)
-	return irel;
-    }
-
-  return NULL;
-}
-
-
-bfd_boolean
-is_removable_literal (const source_reloc *rel,
-		      int i,
-		      const source_reloc *src_relocs,
-		      int src_count)
-{
-  const source_reloc *curr_rel;
-  if (!rel->is_null)
-    return FALSE;
-  
-  for (++i; i < src_count; ++i)
-    {
-      curr_rel = &src_relocs[i];
-      /* If all others have the same target offset....  */
-      if (curr_rel->r_rel.target_offset != rel->r_rel.target_offset)
-	return TRUE;
-
-      if (!curr_rel->is_null
-	  && !xtensa_is_property_section (curr_rel->source_sec)
-	  && !(curr_rel->source_sec->flags & SEC_DEBUGGING))
-	return FALSE;
-    }
-  return TRUE;
-}
-
-
-bfd_boolean 
-remove_dead_literal (bfd *abfd,
-		     asection *sec,
-		     struct bfd_link_info *link_info,
-		     Elf_Internal_Rela *internal_relocs,
-		     Elf_Internal_Rela *irel,
-		     source_reloc *rel,
-		     property_table_entry *prop_table,
-		     int ptblsize)
-{
-  property_table_entry *entry;
-  xtensa_relax_info *relax_info;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    return FALSE;
-
-  entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
-					  sec->vma + rel->r_rel.target_offset);
-
-  /* Mark the unused literal so that it will be removed.  */
-  add_removed_literal (&relax_info->removed_list, &rel->r_rel, NULL);
-
-  text_action_add (&relax_info->action_list,
-		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
-
-  /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2) 
-    {
-      int fill_extra_space;
-      bfd_vma entry_sec_offset;
-      text_action *fa;
-      property_table_entry *the_add_entry;
-      int removed_diff;
-
-      if (entry)
-	entry_sec_offset = entry->address - sec->vma + entry->size;
-      else
-	entry_sec_offset = rel->r_rel.target_offset + 4;
-
-      /* If the literal range is at the end of the section,
-	 do not add fill.  */
-      the_add_entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
-						      entry_sec_offset);
-      fill_extra_space = compute_fill_extra_space (the_add_entry);
-
-      fa = find_fill_action (&relax_info->action_list, sec, entry_sec_offset);
-      removed_diff = compute_removed_action_diff (fa, sec, entry_sec_offset,
-						  -4, fill_extra_space);
-      if (fa)
-	adjust_fill_action (fa, removed_diff);
-      else
-	text_action_add (&relax_info->action_list,
-			 ta_fill, sec, entry_sec_offset, removed_diff);
-    }
-
-  /* Zero out the relocation on this literal location.  */
-  if (irel)
-    {
-      if (elf_hash_table (link_info)->dynamic_sections_created)
-	shrink_dynamic_reloc_sections (link_info, abfd, sec, irel);
-
-      irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
-      pin_internal_relocs (sec, internal_relocs);
-    }
-
-  /* Do not modify "last_loc_is_prev".  */
-  return TRUE;
-}
-
-
-bfd_boolean 
-identify_literal_placement (bfd *abfd,
-			    asection *sec,
-			    bfd_byte *contents,
-			    struct bfd_link_info *link_info,
-			    value_map_hash_table *values,
-			    bfd_boolean *last_loc_is_prev_p,
-			    Elf_Internal_Rela *irel,
-			    int remaining_src_rels,
-			    source_reloc *rel,
-			    property_table_entry *prop_table,
-			    int ptblsize,
-			    section_cache_t *target_sec_cache,
-			    bfd_boolean is_abs_literal)
-{
-  literal_value val;
-  value_map *val_map;
-  xtensa_relax_info *relax_info;
-  bfd_boolean literal_placed = FALSE;
-  r_reloc r_rel;
-  unsigned long value;
-  bfd_boolean final_static_link;
-  bfd_size_type sec_size;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    return FALSE;
-
-  sec_size = bfd_get_section_limit (abfd, sec);
-
   final_static_link =
     (!link_info->relocatable
      && !elf_hash_table (link_info)->dynamic_sections_created);
 
-  /* The placement algorithm first checks to see if the literal is
-     already in the value map.  If so and the value map is reachable
-     from all uses, then the literal is moved to that location.  If
-     not, then we identify the last location where a fresh literal was
-     placed.  If the literal can be safely moved there, then we do so.
-     If not, then we assume that the literal is not to move and leave
-     the literal where it is, marking it as the last literal
-     location.  */
+  /* Sort the source_relocs by target offset.  */
+  src_relocs = relax_info->src_relocs;
+  qsort (src_relocs, relax_info->src_count,
+	 sizeof (source_reloc), source_reloc_compare);
 
-  /* Find the literal value.  */
-  value = 0;
-  r_reloc_init (&r_rel, abfd, irel, contents, sec_size);
-  if (!irel)
+  for (i = 0; i < relax_info->src_count; i++)
     {
-      BFD_ASSERT (rel->r_rel.target_offset < sec_size);
-      value = bfd_get_32 (abfd, contents + rel->r_rel.target_offset);
-    }
-  init_literal_value (&val, &r_rel, value, is_abs_literal);
+      source_reloc *rel;
+      Elf_Internal_Rela *irel = NULL;
+      literal_value val;
+      value_map *val_map;
 
-  /* Check if we've seen another literal with the same value that
-     is in the same output section.  */
-  val_map = value_map_get_cached_value (values, &val, final_static_link);
+      rel = &src_relocs[i];
+      irel = get_irel_at_offset (sec, internal_relocs,
+				 rel->r_rel.target_offset);
 
-  if (val_map
-      && (r_reloc_get_section (&val_map->loc)->output_section
-	  == sec->output_section)
-      && relocations_reach (rel, remaining_src_rels, &val_map->loc)
-      && coalesce_shared_literal (sec, rel, prop_table, ptblsize, val_map))
-    {
-      /* No change to last_loc_is_prev.  */
-      literal_placed = TRUE;
-    }
+      /* If the target_offset for this relocation is the same as the
+	 previous relocation, then we've already considered whether the
+	 literal can be coalesced.  Skip to the next one....  */
+      if (i != 0 && (src_relocs[i-1].r_rel.target_offset
+		     == rel->r_rel.target_offset))
+	continue;
 
-  /* For relocatable links, do not try to move literals.  To do it
-     correctly might increase the number of relocations in an input
-     section making the default relocatable linking fail.  */
-  if (!link_info->relocatable && !literal_placed 
-      && values->has_last_loc && !(*last_loc_is_prev_p))
-    {
-      asection *target_sec = r_reloc_get_section (&values->last_loc);
-      if (target_sec && target_sec->output_section == sec->output_section)
+      /* Check if the relocation was from an L32R that is being removed
+	 because a CALLX was converted to a direct CALL, and check if
+	 there are no other relocations to the literal.  */
+      if (rel->is_null
+	  && (i == relax_info->src_count - 1
+	      || (src_relocs[i+1].r_rel.target_offset
+		  != rel->r_rel.target_offset)))
 	{
-	  /* Increment the virtual offset.  */
-	  r_reloc try_loc = values->last_loc;
-	  try_loc.virtual_offset += 4;
+	  /* Mark the unused literal so that it will be removed.  */
+	  add_removed_literal (&relax_info->removed_list, &rel->r_rel, NULL);
 
-	  /* There is a last loc that was in the same output section.  */
-	  if (relocations_reach (rel, remaining_src_rels, &try_loc)
-	      && move_shared_literal (sec, link_info, rel,
-				      prop_table, ptblsize, 
-				      &try_loc, &val, target_sec_cache))
+	  /* Zero out the relocation on this literal location.  */
+	  if (irel)
 	    {
-	      values->last_loc.virtual_offset += 4;
-	      literal_placed = TRUE;
-	      if (!val_map)
-		val_map = add_value_map (values, &val, &try_loc,
-					 final_static_link);
-	      else
-		val_map->loc = try_loc;
+	      if (elf_hash_table (link_info)->dynamic_sections_created)
+		shrink_dynamic_reloc_sections (link_info, abfd, sec, irel);
+
+	      irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
 	    }
+
+	  continue;
+	}
+
+      /* Find the literal value.  */
+      r_reloc_init (&val.r_rel, abfd, irel);
+      BFD_ASSERT (rel->r_rel.target_offset < sec->size);
+      val.value = bfd_get_32 (abfd, contents + rel->r_rel.target_offset);
+          
+      /* Check if we've seen another literal with the same value.  */
+      val_map = get_cached_value (values, &val, final_static_link);
+      if (val_map != NULL) 
+	{
+	  /* First check that THIS and all the other relocs to this
+	     literal will FIT if we move them to the new address.  */
+
+	  if (relocations_reach (rel, relax_info->src_count - i,
+				 &val_map->loc))
+	    {
+	      /* Mark that the literal will be coalesced.  */
+	      add_removed_literal (&relax_info->removed_list,
+				   &rel->r_rel, &val_map->loc);
+	    }
+	  else
+	    {
+	      /* Relocations do not reach -- do not remove this literal.  */
+	      val_map->loc = rel->r_rel;
+	    }
+	}
+      else
+	{
+	  /* This is the first time we've seen this literal value.  */
+	  BFD_ASSERT (sec == r_reloc_get_section (&rel->r_rel));
+	  add_value_map (values, &val, &rel->r_rel, final_static_link);
 	}
     }
 
-  if (!literal_placed)
-    {
-      /* Nothing worked, leave the literal alone but update the last loc.  */
-      values->has_last_loc = TRUE;
-      values->last_loc = rel->r_rel;
-      if (!val_map)
-	val_map = add_value_map (values, &val, &rel->r_rel, final_static_link);
-      else
-	val_map->loc = rel->r_rel;
-      *last_loc_is_prev_p = TRUE;
-    }
-
-  return TRUE;
+error_return:
+  release_contents (sec, contents);
+  release_internal_relocs (sec, internal_relocs);
+  return ok;
 }
 
 
@@ -7423,9 +4596,10 @@
    literal will be contiguous.  */
 
 static bfd_boolean
-relocations_reach (source_reloc *reloc,
-		   int remaining_relocs,
-		   const r_reloc *r_rel)
+relocations_reach (reloc, remaining_relocs, r_rel)
+     source_reloc *reloc;
+     int remaining_relocs;
+     const r_reloc *r_rel;
 {
   bfd_vma from_offset, source_address, dest_address;
   asection *sec;
@@ -7452,8 +4626,9 @@
 	  != sec->output_section)
 	return FALSE;
 
-      /* A literal with no PC-relative relocations can be moved anywhere.  */
-      if (reloc[i].opnd != -1)
+      /* A NULL operand means it is not a PC-relative relocation, so
+         the literal can be moved anywhere.  */
+      if (reloc[i].opnd)
 	{
 	  /* Otherwise, check to see that it fits.  */
 	  source_address = (reloc[i].source_sec->output_section->vma
@@ -7463,8 +4638,7 @@
 			  + sec->output_offset
 			  + r_rel->target_offset);
 
-	  if (!pcrel_reloc_fits (reloc[i].opcode, reloc[i].opnd,
-				 source_address, dest_address))
+	  if (!pcrel_reloc_fits (reloc[i].opnd, source_address, dest_address))
 	    return FALSE;
 	}
     }
@@ -7473,219 +4647,27 @@
 }
 
 
-/* Move a literal to another literal location because it is
-   the same as the other literal value.  */
+/* WARNING: linear search here.  If the relocation are in order by
+   address, we can use a faster binary search.  ALSO, we assume that
+   there is only 1 non-NONE relocation per address.  */
 
-static bfd_boolean 
-coalesce_shared_literal (asection *sec,
-			 source_reloc *rel,
-			 property_table_entry *prop_table,
-			 int ptblsize,
-			 value_map *val_map)
+static Elf_Internal_Rela *
+get_irel_at_offset (sec, internal_relocs, offset)
+     asection *sec;
+     Elf_Internal_Rela *internal_relocs;
+     bfd_vma offset;
 {
-  property_table_entry *entry;
-  text_action *fa;
-  property_table_entry *the_add_entry;
-  int removed_diff;
-  xtensa_relax_info *relax_info;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    return FALSE;
-
-  entry = elf_xtensa_find_property_entry
-    (prop_table, ptblsize, sec->vma + rel->r_rel.target_offset);
-  if (entry && (entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM))
-    return TRUE;
-
-  /* Mark that the literal will be coalesced.  */
-  add_removed_literal (&relax_info->removed_list, &rel->r_rel, &val_map->loc);
-
-  text_action_add (&relax_info->action_list,
-		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
-
-  /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2) 
+  unsigned i;
+  if (!internal_relocs) 
+    return NULL;
+  for (i = 0; i < sec->reloc_count; i++)
     {
-      int fill_extra_space;
-      bfd_vma entry_sec_offset;
-
-      if (entry)
-	entry_sec_offset = entry->address - sec->vma + entry->size;
-      else
-	entry_sec_offset = rel->r_rel.target_offset + 4;
-
-      /* If the literal range is at the end of the section,
-	 do not add fill.  */
-      fill_extra_space = 0;
-      the_add_entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
-						      entry_sec_offset);
-      if (the_add_entry && (the_add_entry->flags & XTENSA_PROP_UNREACHABLE))
-	fill_extra_space = the_add_entry->size;
-
-      fa = find_fill_action (&relax_info->action_list, sec, entry_sec_offset);
-      removed_diff = compute_removed_action_diff (fa, sec, entry_sec_offset,
-						  -4, fill_extra_space);
-      if (fa)
-	adjust_fill_action (fa, removed_diff);
-      else
-	text_action_add (&relax_info->action_list,
-			 ta_fill, sec, entry_sec_offset, removed_diff);
+      Elf_Internal_Rela *irel = &internal_relocs[i];
+      if (irel->r_offset == offset
+	  && ELF32_R_TYPE (irel->r_info) != R_XTENSA_NONE)
+	return irel;
     }
-
-  return TRUE;
-}
-
-
-/* Move a literal to another location.  This may actually increase the
-   total amount of space used because of alignments so we need to do
-   this carefully.  Also, it may make a branch go out of range.  */
-
-static bfd_boolean 
-move_shared_literal (asection *sec,
-		     struct bfd_link_info *link_info,
-		     source_reloc *rel,
-		     property_table_entry *prop_table,
-		     int ptblsize,
-		     const r_reloc *target_loc,
-		     const literal_value *lit_value,
-		     section_cache_t *target_sec_cache)
-{
-  property_table_entry *the_add_entry, *src_entry, *target_entry = NULL;
-  text_action *fa, *target_fa;
-  int removed_diff;
-  xtensa_relax_info *relax_info, *target_relax_info;
-  asection *target_sec;
-  ebb_t *ebb;
-  ebb_constraint ebb_table;
-  bfd_boolean relocs_fit;
-
-  /* If this routine always returns FALSE, the literals that cannot be
-     coalesced will not be moved.  */
-  if (elf32xtensa_no_literal_movement)
-    return FALSE;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    return FALSE;
-
-  target_sec = r_reloc_get_section (target_loc);
-  target_relax_info = get_xtensa_relax_info (target_sec);
-
-  /* Literals to undefined sections may not be moved because they
-     must report an error.  */
-  if (bfd_is_und_section (target_sec))
-    return FALSE;
-
-  src_entry = elf_xtensa_find_property_entry
-    (prop_table, ptblsize, sec->vma + rel->r_rel.target_offset);
-
-  if (!section_cache_section (target_sec_cache, target_sec, link_info))
-    return FALSE;
-
-  target_entry = elf_xtensa_find_property_entry
-    (target_sec_cache->ptbl, target_sec_cache->pte_count, 
-     target_sec->vma + target_loc->target_offset);
-
-  if (!target_entry)
-    return FALSE;
-
-  /* Make sure that we have not broken any branches.  */
-  relocs_fit = FALSE;
-
-  init_ebb_constraint (&ebb_table);
-  ebb = &ebb_table.ebb;
-  init_ebb (ebb, target_sec_cache->sec, target_sec_cache->contents, 
-	    target_sec_cache->content_length,
-	    target_sec_cache->ptbl, target_sec_cache->pte_count,
-	    target_sec_cache->relocs, target_sec_cache->reloc_count);
-
-  /* Propose to add 4 bytes + worst-case alignment size increase to
-     destination.  */
-  ebb_propose_action (&ebb_table, EBB_NO_ALIGN, 0,
-		      ta_fill, target_loc->target_offset,
-		      -4 - (1 << target_sec->alignment_power), TRUE);
-
-  /* Check all of the PC-relative relocations to make sure they still fit.  */
-  relocs_fit = check_section_ebb_pcrels_fit (target_sec->owner, target_sec, 
-					     target_sec_cache->contents,
-					     target_sec_cache->relocs,
-					     &ebb_table);
-
-  if (!relocs_fit) 
-    return FALSE;
-
-  text_action_add_literal (&target_relax_info->action_list,
-			   ta_add_literal, target_loc, lit_value, -4);
-
-  if (target_sec->alignment_power > 2 && target_entry != src_entry) 
-    {
-      /* May need to add or remove some fill to maintain alignment.  */
-      int fill_extra_space;
-      bfd_vma entry_sec_offset;
-
-      entry_sec_offset = 
-	target_entry->address - target_sec->vma + target_entry->size;
-
-      /* If the literal range is at the end of the section,
-	 do not add fill.  */
-      fill_extra_space = 0;
-      the_add_entry =
-	elf_xtensa_find_property_entry (target_sec_cache->ptbl,
-					target_sec_cache->pte_count,
-					entry_sec_offset);
-      if (the_add_entry && (the_add_entry->flags & XTENSA_PROP_UNREACHABLE))
-	fill_extra_space = the_add_entry->size;
-
-      target_fa = find_fill_action (&target_relax_info->action_list,
-				    target_sec, entry_sec_offset);
-      removed_diff = compute_removed_action_diff (target_fa, target_sec,
-						  entry_sec_offset, 4,
-						  fill_extra_space);
-      if (target_fa)
-	adjust_fill_action (target_fa, removed_diff);
-      else
-	text_action_add (&target_relax_info->action_list,
-			 ta_fill, target_sec, entry_sec_offset, removed_diff);
-    }
-
-  /* Mark that the literal will be moved to the new location.  */
-  add_removed_literal (&relax_info->removed_list, &rel->r_rel, target_loc);
-
-  /* Remove the literal.  */
-  text_action_add (&relax_info->action_list,
-		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
-
-  /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2 && target_entry != src_entry) 
-    {
-      int fill_extra_space;
-      bfd_vma entry_sec_offset;
-
-      if (src_entry)
-	entry_sec_offset = src_entry->address - sec->vma + src_entry->size;
-      else
-	entry_sec_offset = rel->r_rel.target_offset+4;
-
-      /* If the literal range is at the end of the section,
-	 do not add fill.  */
-      fill_extra_space = 0;
-      the_add_entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
-						      entry_sec_offset);
-      if (the_add_entry && (the_add_entry->flags & XTENSA_PROP_UNREACHABLE))
-	fill_extra_space = the_add_entry->size;
-
-      fa = find_fill_action (&relax_info->action_list, sec, entry_sec_offset);
-      removed_diff = compute_removed_action_diff (fa, sec, entry_sec_offset,
-						  -4, fill_extra_space);
-      if (fa)
-	adjust_fill_action (fa, removed_diff);
-      else
-	text_action_add (&relax_info->action_list,
-			 ta_fill, sec, entry_sec_offset, removed_diff);
-    }
-
-  return TRUE;
+  return NULL;
 }
 
 
@@ -7693,27 +4675,23 @@
 
 /* Modify all of the relocations to point to the right spot, and if this
    is a relaxable section, delete the unwanted literals and fix the
-   section size.  */
+   cooked_size.  */
 
-bfd_boolean
-relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
+bfd_boolean 
+relax_section (abfd, sec, link_info)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
 {
   Elf_Internal_Rela *internal_relocs;
   xtensa_relax_info *relax_info;
   bfd_byte *contents;
   bfd_boolean ok = TRUE;
   unsigned i;
-  bfd_boolean rv = FALSE;
-  bfd_boolean virtual_action;
-  bfd_size_type sec_size;
 
-  sec_size = bfd_get_section_limit (abfd, sec);
   relax_info = get_xtensa_relax_info (sec);
   BFD_ASSERT (relax_info);
 
-  /* First translate any of the fixes that have been added already.  */
-  translate_section_fixes (sec);
-
   /* Handle property sections (e.g., literal tables) specially.  */
   if (xtensa_is_property_section (sec))
     {
@@ -7724,7 +4702,7 @@
   internal_relocs = retrieve_internal_relocs (abfd, sec, 
 					      link_info->keep_memory);
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       ok = FALSE;
       goto error_return;
@@ -7732,11 +4710,11 @@
 
   if (internal_relocs)
     {
-      for (i = 0; i < sec->reloc_count; i++)
+      for (i = 0; i < sec->reloc_count; i++) 
 	{
 	  Elf_Internal_Rela *irel;
 	  xtensa_relax_info *target_relax_info;
-	  bfd_vma source_offset, old_source_offset;
+	  bfd_vma source_offset;
 	  r_reloc r_rel;
 	  unsigned r_type;
 	  asection *target_sec;
@@ -7749,17 +4727,11 @@
 
 	  irel = &internal_relocs[i];
 	  source_offset = irel->r_offset;
-	  old_source_offset = source_offset;
 
 	  r_type = ELF32_R_TYPE (irel->r_info);
-	  r_reloc_init (&r_rel, abfd, irel, contents,
-			bfd_get_section_limit (abfd, sec));
-
-	  /* If this section could have changed then we may need to
-	     change the relocation's offset.  */
-
-	  if (relax_info->is_relaxable_literal_section
-	      || relax_info->is_relaxable_asm_section)
+	  r_reloc_init (&r_rel, abfd, irel);
+	
+	  if (relax_info->is_relaxable_literal_section)
 	    {
 	      if (r_type != R_XTENSA_NONE
 		  && find_removed_literal (&relax_info->removed_list,
@@ -7769,141 +4741,34 @@
 		  if (elf_hash_table (link_info)->dynamic_sections_created)
 		    shrink_dynamic_reloc_sections (link_info, abfd, sec, irel);
 		  irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
-		  irel->r_offset = offset_with_removed_text
-		    (&relax_info->action_list, irel->r_offset);
-		  pin_internal_relocs (sec, internal_relocs);
+		  irel->r_offset = offset_with_removed_literals
+		    (&relax_info->removed_list, irel->r_offset);
 		  continue;
 		}
-
-	      if (r_type == R_XTENSA_ASM_SIMPLIFY)
-		{
-		  text_action *action =
-		    find_insn_action (&relax_info->action_list,
-				      irel->r_offset);
-		  if (action && (action->action == ta_convert_longcall
-				 || action->action == ta_remove_longcall))
-		    {
-		      bfd_reloc_status_type retval;
-		      char *error_message = NULL;
-
-		      retval = contract_asm_expansion (contents, sec_size,
-						       irel, &error_message);
-		      if (retval != bfd_reloc_ok)
-			{
-			  (*link_info->callbacks->reloc_dangerous)
-			    (link_info, error_message, abfd, sec,
-			     irel->r_offset);
-			  goto error_return;
-			}
-		      /* Update the action so that the code that moves
-			 the contents will do the right thing.  */
-		      if (action->action == ta_remove_longcall)
-			action->action = ta_remove_insn;
-		      else
-			action->action = ta_none;
-		      /* Refresh the info in the r_rel.  */
-		      r_reloc_init (&r_rel, abfd, irel, contents, sec_size);
-		      r_type = ELF32_R_TYPE (irel->r_info);
-		    }
-		}
-
-	      source_offset = offset_with_removed_text
-		(&relax_info->action_list, irel->r_offset);
+	      source_offset =
+		offset_with_removed_literals (&relax_info->removed_list,
+					      irel->r_offset);
 	      irel->r_offset = source_offset;
 	    }
 
-	  /* If the target section could have changed then
-	     we may need to change the relocation's target offset.  */
-
 	  target_sec = r_reloc_get_section (&r_rel);
 	  target_relax_info = get_xtensa_relax_info (target_sec);
 
 	  if (target_relax_info
-	      && (target_relax_info->is_relaxable_literal_section
-		  || target_relax_info->is_relaxable_asm_section))
+	      && target_relax_info->is_relaxable_literal_section)
 	    {
-	      r_reloc new_reloc;
+	      r_reloc new_rel;
 	      reloc_bfd_fix *fix;
-	      bfd_vma addend_displacement;
 
-	      translate_reloc (&r_rel, &new_reloc);
-
-	      if (r_type == R_XTENSA_DIFF8
-		  || r_type == R_XTENSA_DIFF16
-		  || r_type == R_XTENSA_DIFF32)
-		{
-		  bfd_vma diff_value = 0, new_end_offset, diff_mask = 0;
-
-		  if (bfd_get_section_limit (abfd, sec) < old_source_offset)
-		    {
-		      (*link_info->callbacks->reloc_dangerous)
-			(link_info, _("invalid relocation address"),
-			 abfd, sec, old_source_offset);
-		      goto error_return;
-		    }
-
-		  switch (r_type)
-		    {
-		    case R_XTENSA_DIFF8:
-		      diff_value =
-			bfd_get_8 (abfd, &contents[old_source_offset]);
-		      break;
-		    case R_XTENSA_DIFF16:
-		      diff_value =
-			bfd_get_16 (abfd, &contents[old_source_offset]);
-		      break;
-		    case R_XTENSA_DIFF32:
-		      diff_value =
-			bfd_get_32 (abfd, &contents[old_source_offset]);
-		      break;
-		    }
-
-		  new_end_offset = offset_with_removed_text
-		    (&target_relax_info->action_list,
-		     r_rel.target_offset + diff_value);
-		  diff_value = new_end_offset - new_reloc.target_offset;
-
-		  switch (r_type)
-		    {
-		    case R_XTENSA_DIFF8:
-		      diff_mask = 0xff;
-		      bfd_put_8 (abfd, diff_value,
-				 &contents[old_source_offset]);
-		      break;
-		    case R_XTENSA_DIFF16:
-		      diff_mask = 0xffff;
-		      bfd_put_16 (abfd, diff_value,
-				  &contents[old_source_offset]);
-		      break;
-		    case R_XTENSA_DIFF32:
-		      diff_mask = 0xffffffff;
-		      bfd_put_32 (abfd, diff_value,
-				  &contents[old_source_offset]);
-		      break;
-		    }
-
-		  /* Check for overflow.  */
-		  if ((diff_value & ~diff_mask) != 0)
-		    {
-		      (*link_info->callbacks->reloc_dangerous)
-			(link_info, _("overflow after relaxation"),
-			 abfd, sec, old_source_offset);
-		      goto error_return;
-		    }
-
-		  pin_contents (sec, contents);
-		}
+	      translate_reloc (&r_rel, &new_rel);
 
 	      /* FIXME: If the relocation still references a section in
 		 the same input file, the relocation should be modified
 		 directly instead of adding a "fix" record.  */
 
-	      addend_displacement =
-		new_reloc.target_offset + new_reloc.virtual_offset;
-
 	      fix = reloc_bfd_fix_init (sec, source_offset, r_type, 0,
-					r_reloc_get_section (&new_reloc),
-					addend_displacement, TRUE);
+					r_reloc_get_section (&new_rel),
+					new_rel.target_offset);
 	      add_fix (sec, fix);
 	    }
 
@@ -7911,217 +4776,37 @@
 	}
     }
 
-  if ((relax_info->is_relaxable_literal_section
-       || relax_info->is_relaxable_asm_section)
-      && relax_info->action_list.head)
+  if (relax_info->is_relaxable_literal_section)
     {
-      /* Walk through the planned actions and build up a table
-	 of move, copy and fill records.  Use the move, copy and
-	 fill records to perform the actions once.  */
+      /* Walk through the contents and delete literals that are not needed 
+         anymore.  */
 
-      bfd_size_type size = sec->size;
-      int removed = 0;
-      bfd_size_type final_size, copy_size, orig_insn_size;
-      bfd_byte *scratch = NULL;
-      bfd_byte *dup_contents = NULL;
-      bfd_size_type orig_size = size;
-      bfd_vma orig_dot = 0;
-      bfd_vma orig_dot_copied = 0; /* Byte copied already from
-					    orig dot in physical memory.  */
-      bfd_vma orig_dot_vo = 0; /* Virtual offset from orig_dot.  */
-      bfd_vma dup_dot = 0;
+      unsigned long size = sec->size;
+      unsigned long removed = 0;
 
-      text_action *action = relax_info->action_list.head;
-
-      final_size = sec->size;
-      for (action = relax_info->action_list.head; action;
-	   action = action->next)
+      removed_literal *reloc = relax_info->removed_list.head;
+      for (; reloc; reloc = reloc->next) 
 	{
-	  final_size -= action->removed_bytes;
-	}
-
-      scratch = (bfd_byte *) bfd_zmalloc (final_size);
-      dup_contents = (bfd_byte *) bfd_zmalloc (final_size);
-
-      /* The dot is the current fill location.  */
-#if DEBUG
-      print_action_list (stderr, &relax_info->action_list);
-#endif
-
-      for (action = relax_info->action_list.head; action;
-	   action = action->next)
-	{
-	  virtual_action = FALSE;
-	  if (action->offset > orig_dot)
+	  unsigned long upper = sec->size;
+	  bfd_vma start = reloc->from.target_offset + 4;
+	  if (reloc->next)
+	    upper = reloc->next->from.target_offset;
+	  if (upper - start != 0) 
 	    {
-	      orig_dot += orig_dot_copied;
-	      orig_dot_copied = 0;
-	      orig_dot_vo = 0;
-	      /* Out of the virtual world.  */
-	    }
-
-	  if (action->offset > orig_dot)
-	    {
-	      copy_size = action->offset - orig_dot;
-	      memmove (&dup_contents[dup_dot], &contents[orig_dot], copy_size);
-	      orig_dot += copy_size;
-	      dup_dot += copy_size;
-	      BFD_ASSERT (action->offset == orig_dot);
-	    }
-	  else if (action->offset < orig_dot)
-	    {
-	      if (action->action == ta_fill
-		  && action->offset - action->removed_bytes == orig_dot)
-		{
-		  /* This is OK because the fill only effects the dup_dot.  */
-		}
-	      else if (action->action == ta_add_literal)
-		{
-		  /* TBD.  Might need to handle this.  */
-		}
-	    }
-	  if (action->offset == orig_dot)
-	    {
-	      if (action->virtual_offset > orig_dot_vo)
-		{
-		  if (orig_dot_vo == 0)
-		    {
-		      /* Need to copy virtual_offset bytes.  Probably four.  */
-		      copy_size = action->virtual_offset - orig_dot_vo;
-		      memmove (&dup_contents[dup_dot],
-			       &contents[orig_dot], copy_size);
-		      orig_dot_copied = copy_size;
-		      dup_dot += copy_size;
-		    }
-		  virtual_action = TRUE;
-		} 
-	      else
-		BFD_ASSERT (action->virtual_offset <= orig_dot_vo);
-	    }
-	  switch (action->action)
-	    {
-	    case ta_remove_literal:
-	    case ta_remove_insn:
-	      BFD_ASSERT (action->removed_bytes >= 0);
-	      orig_dot += action->removed_bytes;
-	      break;
-
-	    case ta_narrow_insn:
-	      orig_insn_size = 3;
-	      copy_size = 2;
-	      memmove (scratch, &contents[orig_dot], orig_insn_size);
-	      BFD_ASSERT (action->removed_bytes == 1);
-	      rv = narrow_instruction (scratch, final_size, 0, TRUE);
-	      BFD_ASSERT (rv);
-	      memmove (&dup_contents[dup_dot], scratch, copy_size);
-	      orig_dot += orig_insn_size;
-	      dup_dot += copy_size;
-	      break;
-
-	    case ta_fill:
-	      if (action->removed_bytes >= 0)
-		orig_dot += action->removed_bytes;
-	      else
-		{
-		  /* Already zeroed in dup_contents.  Just bump the
-		     counters.  */
-		  dup_dot += (-action->removed_bytes);
-		}
-	      break;
-
-	    case ta_none:
-	      BFD_ASSERT (action->removed_bytes == 0);
-	      break;
-
-	    case ta_convert_longcall:
-	    case ta_remove_longcall:
-	      /* These will be removed or converted before we get here.  */
-	      BFD_ASSERT (0);
-	      break;
-
-	    case ta_widen_insn:
-	      orig_insn_size = 2;
-	      copy_size = 3;
-	      memmove (scratch, &contents[orig_dot], orig_insn_size);
-	      BFD_ASSERT (action->removed_bytes == -1);
-	      rv = widen_instruction (scratch, final_size, 0, TRUE);
-	      BFD_ASSERT (rv);
-	      memmove (&dup_contents[dup_dot], scratch, copy_size);
-	      orig_dot += orig_insn_size;
-	      dup_dot += copy_size;
-	      break;
-
-	    case ta_add_literal:
-	      orig_insn_size = 0;
-	      copy_size = 4;
-	      BFD_ASSERT (action->removed_bytes == -4);
-	      /* TBD -- place the literal value here and insert
-		 into the table.  */
-	      memset (&dup_contents[dup_dot], 0, 4);
-	      pin_internal_relocs (sec, internal_relocs);
+	      BFD_ASSERT (start <= upper);
+	      memmove (contents + start - removed - 4,
+		       contents + start,
+		       upper - start );
 	      pin_contents (sec, contents);
-
-	      if (!move_literal (abfd, link_info, sec, dup_dot, dup_contents,
-				 relax_info, &internal_relocs, &action->value))
-		goto error_return;
-
-	      if (virtual_action) 
-		orig_dot_vo += copy_size;
-
-	      orig_dot += orig_insn_size;
-	      dup_dot += copy_size;
-	      break;
-
-	    default:
-	      /* Not implemented yet.  */
-	      BFD_ASSERT (0);
-	      break;
 	    }
-
-	  size -= action->removed_bytes;
-	  removed += action->removed_bytes;
-	  BFD_ASSERT (dup_dot <= final_size);
-	  BFD_ASSERT (orig_dot <= orig_size);
+	  removed += 4;
+	  size -= 4;
 	}
 
-      orig_dot += orig_dot_copied;
-      orig_dot_copied = 0;
-
-      if (orig_dot != orig_size)
-	{
-	  copy_size = orig_size - orig_dot;
-	  BFD_ASSERT (orig_size > orig_dot);
-	  BFD_ASSERT (dup_dot + copy_size == final_size);
-	  memmove (&dup_contents[dup_dot], &contents[orig_dot], copy_size);
-	  orig_dot += copy_size;
-	  dup_dot += copy_size;
-	}
-      BFD_ASSERT (orig_size == orig_dot);
-      BFD_ASSERT (final_size == dup_dot);
-
-      /* Move the dup_contents back.  */
-      if (final_size > orig_size)
-	{
-	  /* Contents need to be reallocated.  Swap the dup_contents into
-	     contents.  */
-	  sec->contents = dup_contents;
-	  free (contents);
-	  contents = dup_contents;
-	  pin_contents (sec, contents);
-	}
-      else
-	{
-	  BFD_ASSERT (final_size <= orig_size);
-	  memset (contents, 0, orig_size);
-	  memcpy (contents, dup_contents, final_size);
-	  free (dup_contents);
-	}
-      free (scratch);
-      pin_contents (sec, contents);
-
-      sec->size = final_size;
+      /* Change the section size.  */
+      sec->size = size;
     }
-
+  
  error_return:
   release_internal_relocs (sec, internal_relocs);
   release_contents (sec, contents);
@@ -8129,124 +4814,17 @@
 }
 
 
-static bfd_boolean 
-translate_section_fixes (asection *sec)
-{
-  xtensa_relax_info *relax_info;
-  reloc_bfd_fix *r;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    return TRUE;
-
-  for (r = relax_info->fix_list; r != NULL; r = r->next)
-    if (!translate_reloc_bfd_fix (r))
-      return FALSE;
-
-  return TRUE;
-}
-
-
-/* Translate a fix given the mapping in the relax info for the target
-   section.  If it has already been translated, no work is required.  */
-
-static bfd_boolean 
-translate_reloc_bfd_fix (reloc_bfd_fix *fix)
-{
-  reloc_bfd_fix new_fix;
-  asection *sec;
-  xtensa_relax_info *relax_info;
-  removed_literal *removed;
-  bfd_vma new_offset, target_offset;
-
-  if (fix->translated)
-    return TRUE;
-
-  sec = fix->target_sec;
-  target_offset = fix->target_offset;
-
-  relax_info = get_xtensa_relax_info (sec);
-  if (!relax_info)
-    {
-      fix->translated = TRUE;
-      return TRUE;
-    }
-
-  new_fix = *fix;
-
-  /* The fix does not need to be translated if the section cannot change.  */
-  if (!relax_info->is_relaxable_literal_section
-      && !relax_info->is_relaxable_asm_section)
-    {
-      fix->translated = TRUE;
-      return TRUE;
-    }
-
-  /* If the literal has been moved and this relocation was on an
-     opcode, then the relocation should move to the new literal
-     location.  Otherwise, the relocation should move within the
-     section.  */
-
-  removed = FALSE;
-  if (is_operand_relocation (fix->src_type))
-    {
-      /* Check if the original relocation is against a literal being
-	 removed.  */
-      removed = find_removed_literal (&relax_info->removed_list,
-				      target_offset);
-    }
-
-  if (removed) 
-    {
-      asection *new_sec;
-
-      /* The fact that there is still a relocation to this literal indicates
-	 that the literal is being coalesced, not simply removed.  */
-      BFD_ASSERT (removed->to.abfd != NULL);
-
-      /* This was moved to some other address (possibly another section).  */
-      new_sec = r_reloc_get_section (&removed->to);
-      if (new_sec != sec) 
-	{
-	  sec = new_sec;
-	  relax_info = get_xtensa_relax_info (sec);
-	  if (!relax_info || 
-	      (!relax_info->is_relaxable_literal_section
-	       && !relax_info->is_relaxable_asm_section))
-	    {
-	      target_offset = removed->to.target_offset;
-	      new_fix.target_sec = new_sec;
-	      new_fix.target_offset = target_offset;
-	      new_fix.translated = TRUE;
-	      *fix = new_fix;
-	      return TRUE;
-	    }
-	}
-      target_offset = removed->to.target_offset;
-      new_fix.target_sec = new_sec;
-    }
-
-  /* The target address may have been moved within its section.  */
-  new_offset = offset_with_removed_text (&relax_info->action_list,
-					 target_offset);
-
-  new_fix.target_offset = new_offset;
-  new_fix.target_offset = new_offset;
-  new_fix.translated = TRUE;
-  *fix = new_fix;
-  return TRUE;
-}
-
-
 /* Fix up a relocation to take account of removed literals.  */
 
 static void
-translate_reloc (const r_reloc *orig_rel, r_reloc *new_rel)
+translate_reloc (orig_rel, new_rel)
+     const r_reloc *orig_rel;
+     r_reloc *new_rel;
 {
   asection *sec;
   xtensa_relax_info *relax_info;
   removed_literal *removed;
-  bfd_vma new_offset, target_offset, removed_bytes;
+  unsigned long new_offset;
 
   *new_rel = *orig_rel;
 
@@ -8257,21 +4835,13 @@
   relax_info = get_xtensa_relax_info (sec);
   BFD_ASSERT (relax_info);
 
-  if (!relax_info->is_relaxable_literal_section
-      && !relax_info->is_relaxable_asm_section)
+  if (!relax_info->is_relaxable_literal_section)
     return;
 
-  target_offset = orig_rel->target_offset;
-
-  removed = FALSE;
-  if (is_operand_relocation (ELF32_R_TYPE (orig_rel->rela.r_info)))
-    {
-      /* Check if the original relocation is against a literal being
-	 removed.  */
-      removed = find_removed_literal (&relax_info->removed_list,
-				      target_offset);
-    }
-  if (removed && removed->to.abfd)
+  /* Check if the original relocation is against a literal being removed.  */
+  removed = find_removed_literal (&relax_info->removed_list,
+				  orig_rel->target_offset);
+  if (removed) 
     {
       asection *new_sec;
 
@@ -8279,30 +4849,25 @@
 	 that the literal is being coalesced, not simply removed.  */
       BFD_ASSERT (removed->to.abfd != NULL);
 
-      /* This was moved to some other address
-	 (possibly in another section).  */
+      /* This was moved to some other address (possibly in another section). */
       *new_rel = removed->to;
       new_sec = r_reloc_get_section (new_rel);
-      if (new_sec != sec)
+      if (new_sec != sec) 
 	{
 	  sec = new_sec;
 	  relax_info = get_xtensa_relax_info (sec);
-	  if (!relax_info
-	      || (!relax_info->is_relaxable_literal_section
-		  && !relax_info->is_relaxable_asm_section))
+	  if (!relax_info || !relax_info->is_relaxable_literal_section)
 	    return;
 	}
-      target_offset = new_rel->target_offset;
     }
 
   /* ...and the target address may have been moved within its section.  */
-  new_offset = offset_with_removed_text (&relax_info->action_list,
-					 target_offset);
+  new_offset = offset_with_removed_literals (&relax_info->removed_list,
+					     new_rel->target_offset);
 
   /* Modify the offset and addend.  */
-  removed_bytes = target_offset - new_offset;
   new_rel->target_offset = new_offset;
-  new_rel->rela.r_addend -= removed_bytes;
+  new_rel->rela.r_addend += (new_offset - new_rel->target_offset);
 }
 
 
@@ -8316,10 +4881,11 @@
    nothing else that needs to be done.  */
 
 static void
-shrink_dynamic_reloc_sections (struct bfd_link_info *info,
-			       bfd *abfd,
-			       asection *input_section,
-			       Elf_Internal_Rela *rel)
+shrink_dynamic_reloc_sections (info, abfd, input_section, rel)
+     struct bfd_link_info *info;
+     bfd *abfd;
+     asection *input_section;
+     Elf_Internal_Rela *rel;
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -8411,185 +4977,40 @@
 }
 
 
-/* Take an r_rel and move it to another section.  This usually
-   requires extending the interal_relocation array and pinning it.  If
-   the original r_rel is from the same BFD, we can complete this here.
-   Otherwise, we add a fix record to let the final link fix the
-   appropriate address.  Contents and internal relocations for the
-   section must be pinned after calling this routine.  */
-
-static bfd_boolean
-move_literal (bfd *abfd,
-	      struct bfd_link_info *link_info,
-	      asection *sec,
-	      bfd_vma offset,
-	      bfd_byte *contents,
-	      xtensa_relax_info *relax_info,
-	      Elf_Internal_Rela **internal_relocs_p,
-	      const literal_value *lit)
-{
-  Elf_Internal_Rela *new_relocs = NULL;
-  size_t new_relocs_count = 0;
-  Elf_Internal_Rela this_rela;
-  const r_reloc *r_rel;
-
-  r_rel = &lit->r_rel;
-  BFD_ASSERT (elf_section_data (sec)->relocs == *internal_relocs_p);
-
-  if (r_reloc_is_const (r_rel))
-    bfd_put_32 (abfd, lit->value, contents + offset);
-  else
-    {
-      int r_type;
-      unsigned i;
-      asection *target_sec;
-      reloc_bfd_fix *fix;
-      unsigned insert_at;
-
-      r_type = ELF32_R_TYPE (r_rel->rela.r_info);
-      target_sec = r_reloc_get_section (r_rel);
-
-      /* This is the difficult case.  We have to create a fix up.  */
-      this_rela.r_offset = offset;
-      this_rela.r_info = ELF32_R_INFO (0, r_type);
-      this_rela.r_addend =
-	r_rel->target_offset - r_reloc_get_target_offset (r_rel);
-      bfd_put_32 (abfd, lit->value, contents + offset);
-
-      /* Currently, we cannot move relocations during a relocatable link.  */
-      BFD_ASSERT (!link_info->relocatable);
-      fix = reloc_bfd_fix_init (sec, offset, r_type, r_rel->abfd,
-				r_reloc_get_section (r_rel),
-				r_rel->target_offset + r_rel->virtual_offset,
-				FALSE);
-      /* We also need to mark that relocations are needed here.  */
-      sec->flags |= SEC_RELOC;
-
-      translate_reloc_bfd_fix (fix);
-      /* This fix has not yet been translated.  */
-      add_fix (sec, fix);
-
-      /* Add the relocation.  If we have already allocated our own
-	 space for the relocations and we have room for more, then use
-	 it.  Otherwise, allocate new space and move the literals.  */
-      insert_at = sec->reloc_count;
-      for (i = 0; i < sec->reloc_count; ++i)
-	{
-	  if (this_rela.r_offset < (*internal_relocs_p)[i].r_offset)
-	    {
-	      insert_at = i;
-	      break;
-	    }
-	}
-
-      if (*internal_relocs_p != relax_info->allocated_relocs
-	  || sec->reloc_count + 1 > relax_info->allocated_relocs_count)
-	{
-	  BFD_ASSERT (relax_info->allocated_relocs == NULL
-		      || sec->reloc_count == relax_info->relocs_count);
-
-	  if (relax_info->allocated_relocs_count == 0) 
-	    new_relocs_count = (sec->reloc_count + 2) * 2;
-	  else
-	    new_relocs_count = (relax_info->allocated_relocs_count + 2) * 2;
-
-	  new_relocs = (Elf_Internal_Rela *)
-	    bfd_zmalloc (sizeof (Elf_Internal_Rela) * (new_relocs_count));
-	  if (!new_relocs)
-	    return FALSE;
-
-	  /* We could handle this more quickly by finding the split point.  */
-	  if (insert_at != 0)
-	    memcpy (new_relocs, *internal_relocs_p,
-		    insert_at * sizeof (Elf_Internal_Rela));
-
-	  new_relocs[insert_at] = this_rela;
-
-	  if (insert_at != sec->reloc_count)
-	    memcpy (new_relocs + insert_at + 1,
-		    (*internal_relocs_p) + insert_at,
-		    (sec->reloc_count - insert_at) 
-		    * sizeof (Elf_Internal_Rela));
-
-	  if (*internal_relocs_p != relax_info->allocated_relocs)
-	    {
-	      /* The first time we re-allocate, we can only free the
-		 old relocs if they were allocated with bfd_malloc.
-		 This is not true when keep_memory is in effect.  */
-	      if (!link_info->keep_memory)
-		free (*internal_relocs_p);
-	    }
-	  else
-	    free (*internal_relocs_p);
-	  relax_info->allocated_relocs = new_relocs;
-	  relax_info->allocated_relocs_count = new_relocs_count;
-	  elf_section_data (sec)->relocs = new_relocs;
-	  sec->reloc_count++;
-	  relax_info->relocs_count = sec->reloc_count;
-	  *internal_relocs_p = new_relocs;
-	}
-      else
-	{
-	  if (insert_at != sec->reloc_count)
-	    {
-	      unsigned idx;
-	      for (idx = sec->reloc_count; idx > insert_at; idx--)
-		(*internal_relocs_p)[idx] = (*internal_relocs_p)[idx-1];
-	    }
-	  (*internal_relocs_p)[insert_at] = this_rela;
-	  sec->reloc_count++;
-	  if (relax_info->allocated_relocs)
-	    relax_info->relocs_count = sec->reloc_count;
-	}
-    }
-  return TRUE;
-}
-
-
 /* This is similar to relax_section except that when a target is moved,
    we shift addresses up.  We also need to modify the size.  This
    algorithm does NOT allow for relocations into the middle of the
    property sections.  */
 
-static bfd_boolean
-relax_property_section (bfd *abfd,
-			asection *sec,
-			struct bfd_link_info *link_info)
+static bfd_boolean 
+relax_property_section (abfd, sec, link_info)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
 {
   Elf_Internal_Rela *internal_relocs;
   bfd_byte *contents;
   unsigned i, nexti;
   bfd_boolean ok = TRUE;
-  bfd_boolean is_full_prop_section;
-  size_t last_zfill_target_offset = 0;
-  asection *last_zfill_target_sec = NULL;
-  bfd_size_type sec_size;
 
-  sec_size = bfd_get_section_limit (abfd, sec);
   internal_relocs = retrieve_internal_relocs (abfd, sec, 
 					      link_info->keep_memory);
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       ok = FALSE;
       goto error_return;
     }
 
-  is_full_prop_section =
-    ((strcmp (sec->name, XTENSA_PROP_SEC_NAME) == 0)
-     || (strncmp (sec->name, ".gnu.linkonce.prop.",
-		  sizeof ".gnu.linkonce.prop." - 1) == 0));
-
-  if (internal_relocs)
+  if (internal_relocs) 
     {
-      for (i = 0; i < sec->reloc_count; i++)
+      for (i = 0; i < sec->reloc_count; i++) 
 	{
 	  Elf_Internal_Rela *irel;
 	  xtensa_relax_info *target_relax_info;
+	  r_reloc r_rel;
 	  unsigned r_type;
 	  asection *target_sec;
-	  literal_value val;
-	  bfd_byte *size_p, *flags_p;
 
 	  /* Locally change the source address.
 	     Translate the target to the new target address.
@@ -8602,88 +5023,42 @@
 	  if (r_type == R_XTENSA_NONE)
 	    continue;
 
-	  /* Find the literal value.  */
-	  r_reloc_init (&val.r_rel, abfd, irel, contents, sec_size);
-	  size_p = &contents[irel->r_offset + 4];
-	  flags_p = NULL;
-	  if (is_full_prop_section)
-	    {
-	      flags_p = &contents[irel->r_offset + 8];
-	      BFD_ASSERT (irel->r_offset + 12 <= sec_size);
-	    }
-	  else
-	    BFD_ASSERT (irel->r_offset + 8 <= sec_size);
+	  r_reloc_init (&r_rel, abfd, irel);
 
-	  target_sec = r_reloc_get_section (&val.r_rel);
+	  target_sec = r_reloc_get_section (&r_rel);
 	  target_relax_info = get_xtensa_relax_info (target_sec);
 
 	  if (target_relax_info
-	      && (target_relax_info->is_relaxable_literal_section
-		  || target_relax_info->is_relaxable_asm_section ))
+	      && target_relax_info->is_relaxable_literal_section)
 	    {
 	      /* Translate the relocation's destination.  */
-	      bfd_vma new_offset, new_end_offset;
+	      bfd_vma new_offset;
+	      bfd_vma new_end_offset;
+	      bfd_byte *size_p;
 	      long old_size, new_size;
 
-	      new_offset = offset_with_removed_text
-		(&target_relax_info->action_list, val.r_rel.target_offset);
+	      new_offset =
+		offset_with_removed_literals (&target_relax_info->removed_list,
+					      r_rel.target_offset);
 
 	      /* Assert that we are not out of bounds.  */
-	      old_size = bfd_get_32 (abfd, size_p);
+	      size_p = &contents[irel->r_offset + 4];
+	      old_size = bfd_get_32 (abfd, &contents[irel->r_offset + 4]);
 
-	      if (old_size == 0)
-		{
-		  /* Only the first zero-sized unreachable entry is
-		     allowed to expand.  In this case the new offset
-		     should be the offset before the fill and the new
-		     size is the expansion size.  For other zero-sized
-		     entries the resulting size should be zero with an
-		     offset before or after the fill address depending
-		     on whether the expanding unreachable entry
-		     preceeds it.  */
-		  if (last_zfill_target_sec
-		      && last_zfill_target_sec == target_sec
-		      && last_zfill_target_offset == val.r_rel.target_offset)
-		    new_end_offset = new_offset;
-		  else
-		    {
-		      new_end_offset = new_offset;
-		      new_offset = offset_with_removed_text_before_fill
-			(&target_relax_info->action_list,
-			 val.r_rel.target_offset);
-
-		      /* If it is not unreachable and we have not yet
-			 seen an unreachable at this address, place it
-			 before the fill address.  */
-		      if (!flags_p
-			  || (bfd_get_32 (abfd, flags_p)
-			      & XTENSA_PROP_UNREACHABLE) == 0)
-			new_end_offset = new_offset;
-		      else
-			{
-			  last_zfill_target_sec = target_sec;
-			  last_zfill_target_offset = val.r_rel.target_offset;
-			}
-		    }
-		}
-	      else
-		{
-		  new_end_offset = offset_with_removed_text_before_fill
-		    (&target_relax_info->action_list,
-		     val.r_rel.target_offset + old_size);
-		}
-
+	      new_end_offset =
+		offset_with_removed_literals (&target_relax_info->removed_list,
+					      r_rel.target_offset + old_size);
+	      
 	      new_size = new_end_offset - new_offset;
-
 	      if (new_size != old_size)
 		{
 		  bfd_put_32 (abfd, new_size, size_p);
 		  pin_contents (sec, contents);
 		}
-
-	      if (new_offset != val.r_rel.target_offset)
+	      
+	      if (new_offset != r_rel.target_offset)
 		{
-		  bfd_vma diff = new_offset - val.r_rel.target_offset;
+		  bfd_vma diff = new_offset - r_rel.target_offset;
 		  irel->r_addend += diff;
 		  pin_internal_relocs (sec, internal_relocs);
 		}
@@ -8695,22 +5070,12 @@
      finish_dynamic_sections() but at that point it's too late to
      reclaim the space in the output section, so we do this twice.  */
 
-  if (internal_relocs && (!link_info->relocatable
-			  || strcmp (sec->name, XTENSA_LIT_SEC_NAME) == 0))
+  if (internal_relocs)
     {
       Elf_Internal_Rela *last_irel = NULL;
       int removed_bytes = 0;
       bfd_vma offset, last_irel_offset;
       bfd_vma section_size;
-      bfd_size_type entry_size;
-      flagword predef_flags;
-
-      if (is_full_prop_section)
-	entry_size = 12;
-      else
-	entry_size = 8;
-
-      predef_flags = xtensa_get_property_predef_flags (sec);
 
       /* Walk over memory and irels at the same time.
          This REQUIRES that the internal_relocs be sorted by offset.  */
@@ -8723,14 +5088,13 @@
 
       last_irel_offset = (bfd_vma) -1;
       section_size = sec->size;
-      BFD_ASSERT (section_size % entry_size == 0);
+      BFD_ASSERT (section_size % 8 == 0);
 
-      for (offset = 0; offset < section_size; offset += entry_size)
+      for (offset = 0; offset < section_size; offset += 8)
 	{
 	  Elf_Internal_Rela *irel, *next_irel;
 	  bfd_vma bytes_to_remove, size, actual_offset;
 	  bfd_boolean remove_this_irel;
-	  flagword flags;
 
 	  irel = NULL;
 	  next_irel = NULL;
@@ -8768,38 +5132,28 @@
 	  actual_offset = offset - removed_bytes;
 	  size = bfd_get_32 (abfd, &contents[actual_offset + 4]);
 
-	  if (is_full_prop_section) 
-	    flags = bfd_get_32 (abfd, &contents[actual_offset + 8]);
-	  else
-	    flags = predef_flags;
-
 	  /* Check that the irels are sorted by offset,
 	     with only one per address.  */
 	  BFD_ASSERT (!irel || (int) irel->r_offset > (int) last_irel_offset); 
 	  BFD_ASSERT (!next_irel || next_irel->r_offset > irel->r_offset);
 
-	  /* Make sure there aren't relocs on the size or flag fields.  */
-	  if ((irel && irel->r_offset == offset + 4)
-	      || (is_full_prop_section 
-		  && irel && irel->r_offset == offset + 8))
+	  /* Make sure there isn't a reloc on the size field.  */
+	  if (irel && irel->r_offset == offset + 4)
 	    {
 	      irel->r_offset -= removed_bytes;
 	      last_irel_offset = irel->r_offset;
 	    }
-	  else if (next_irel && (next_irel->r_offset == offset + 4
-				 || (is_full_prop_section 
-				     && next_irel->r_offset == offset + 8)))
+	  else if (next_irel && next_irel->r_offset == offset + 4)
 	    {
 	      nexti += 1;
 	      irel->r_offset -= removed_bytes;
 	      next_irel->r_offset -= removed_bytes;
 	      last_irel_offset = next_irel->r_offset;
 	    }
-	  else if (size == 0 && (flags & XTENSA_PROP_ALIGN) == 0
-		   && (flags & XTENSA_PROP_UNREACHABLE) == 0)
+	  else if (size == 0)
 	    {
-	      /* Always remove entries with zero size and no alignment.  */
-	      bytes_to_remove = entry_size;
+	      /* Always remove entries with zero size.  */
+	      bytes_to_remove = 8;
 	      if (irel && irel->r_offset == offset)
 		{
 		  remove_this_irel = TRUE;
@@ -8814,32 +5168,23 @@
 		{
 		  if (last_irel)
 		    {
-		      flagword old_flags;
-		      bfd_vma old_size =
+		      bfd_vma old_size = 
 			bfd_get_32 (abfd, &contents[last_irel->r_offset + 4]);
-		      bfd_vma old_address =
-			(last_irel->r_addend
+		      bfd_vma old_address = 
+			(last_irel->r_addend 
 			 + bfd_get_32 (abfd, &contents[last_irel->r_offset]));
-		      bfd_vma new_address =
-			(irel->r_addend
+		      bfd_vma new_address = 
+			(irel->r_addend 
 			 + bfd_get_32 (abfd, &contents[actual_offset]));
-		      if (is_full_prop_section) 
-			old_flags = bfd_get_32
-			  (abfd, &contents[last_irel->r_offset + 8]);
-		      else
-			old_flags = predef_flags;
 
-		      if ((ELF32_R_SYM (irel->r_info)
-			   == ELF32_R_SYM (last_irel->r_info))
-			  && old_address + old_size == new_address
-			  && old_flags == flags
-			  && (old_flags & XTENSA_PROP_INSN_BRANCH_TARGET) == 0
-			  && (old_flags & XTENSA_PROP_INSN_LOOP_TARGET) == 0)
+		      if ((ELF32_R_SYM (irel->r_info) ==
+			   ELF32_R_SYM (last_irel->r_info))
+			  && (old_address + old_size == new_address)) 
 			{
-			  /* Fix the old size.  */
+			  /* fix the old size */
 			  bfd_put_32 (abfd, old_size + size,
 				      &contents[last_irel->r_offset + 4]);
-			  bytes_to_remove = entry_size;
+			  bytes_to_remove = 8;
 			  remove_this_irel = TRUE;
 			}
 		      else
@@ -8862,14 +5207,14 @@
 	  if (bytes_to_remove != 0)
 	    {
 	      removed_bytes += bytes_to_remove;
-	      if (offset + bytes_to_remove < section_size)
+	      if (offset + 8 < section_size)
 		memmove (&contents[actual_offset],
-			 &contents[actual_offset + bytes_to_remove],
-			 section_size - offset - bytes_to_remove);
+			 &contents[actual_offset+8],
+			 section_size - offset - 8);
 	    }
 	}
 
-      if (removed_bytes)
+      if (removed_bytes) 
 	{
 	  /* Clear the removed bytes.  */
 	  memset (&contents[section_size - removed_bytes], 0, removed_bytes);
@@ -8901,8 +5246,10 @@
 
 /* Change symbol values to account for removed literals.  */
 
-bfd_boolean
-relax_section_symbols (bfd *abfd, asection *sec)
+bfd_boolean 
+relax_section_symbols (abfd, sec)
+     bfd *abfd;
+     asection *sec;
 {
   xtensa_relax_info *relax_info;
   unsigned int sec_shndx;
@@ -8913,8 +5260,7 @@
   relax_info = get_xtensa_relax_info (sec);
   BFD_ASSERT (relax_info);
 
-  if (!relax_info->is_relaxable_literal_section
-      && !relax_info->is_relaxable_asm_section)
+  if (!relax_info->is_relaxable_literal_section)
     return TRUE;
 
   sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
@@ -8932,19 +5278,10 @@
 
       if (isym->st_shndx == sec_shndx)
 	{
-	  bfd_vma new_address = offset_with_removed_text
-	    (&relax_info->action_list, isym->st_value);
-	  bfd_vma new_size = isym->st_size;
-
-	  if (ELF32_ST_TYPE (isym->st_info) == STT_FUNC)
-	    {
-	      bfd_vma new_end = offset_with_removed_text
-		(&relax_info->action_list, isym->st_value + isym->st_size);
-	      new_size = new_end - new_address;
-	    }
-
-	  isym->st_value = new_address;
-	  isym->st_size = new_size;
+	  bfd_vma new_address = offset_with_removed_literals
+	    (&relax_info->removed_list, isym->st_value);
+	  if (new_address != isym->st_value)
+	    isym->st_value = new_address;
 	}
     }
 
@@ -8962,20 +5299,10 @@
 	   || sym_hash->root.type == bfd_link_hash_defweak)
 	  && sym_hash->root.u.def.section == sec)
 	{
-	  bfd_vma new_address = offset_with_removed_text
-	    (&relax_info->action_list, sym_hash->root.u.def.value);
-	  bfd_vma new_size = sym_hash->size;
-
-	  if (sym_hash->type == STT_FUNC)
-	    {
-	      bfd_vma new_end = offset_with_removed_text
-		(&relax_info->action_list,
-		 sym_hash->root.u.def.value + sym_hash->size);
-	      new_size = new_end - new_address;
-	    }
-
-	  sym_hash->root.u.def.value = new_address;
-	  sym_hash->size = new_size;
+	  bfd_vma new_address = offset_with_removed_literals
+	    (&relax_info->removed_list, sym_hash->root.u.def.value);
+	  if (new_address != sym_hash->root.u.def.value)
+	    sym_hash->root.u.def.value = new_address;
 	}
     }
 
@@ -8985,40 +5312,37 @@
 
 /* "Fix" handling functions, called while performing relocations.  */
 
-static bfd_boolean
-do_fix_for_relocatable_link (Elf_Internal_Rela *rel,
-			     bfd *input_bfd,
-			     asection *input_section,
-			     bfd_byte *contents)
+static void
+do_fix_for_relocatable_link (rel, input_bfd, input_section)
+     Elf_Internal_Rela *rel;
+     bfd *input_bfd;
+     asection *input_section;
 {
   r_reloc r_rel;
   asection *sec, *old_sec;
   bfd_vma old_offset;
   int r_type = ELF32_R_TYPE (rel->r_info);
+  reloc_bfd_fix *fix_list;
   reloc_bfd_fix *fix;
 
   if (r_type == R_XTENSA_NONE)
-    return TRUE;
+    return;
 
-  fix = get_bfd_fix (input_section, rel->r_offset, r_type);
-  if (!fix)
-    return TRUE;
+  fix_list = (get_xtensa_relax_info (input_section))->fix_list;
+  if (fix_list == NULL)
+    return;
 
-  r_reloc_init (&r_rel, input_bfd, rel, contents,
-		bfd_get_section_limit (input_bfd, input_section));
+  fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type);
+  if (fix == NULL)
+    return;
+
+  r_reloc_init (&r_rel, input_bfd, rel);
   old_sec = r_reloc_get_section (&r_rel);
-  old_offset = r_rel.target_offset;
-
-  if (!old_sec || !r_reloc_is_defined (&r_rel))
+  old_offset = r_reloc_get_target_offset (&r_rel);
+	      
+  if (old_sec == NULL || !r_reloc_is_defined (&r_rel))
     {
-      if (r_type != R_XTENSA_ASM_EXPAND)
-	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): unexpected fix for %s relocation"),
-	     input_bfd, input_section, rel->r_offset,
-	     elf_howto_table[r_type].name);
-	  return FALSE;
-	}
+      BFD_ASSERT (r_type == R_XTENSA_ASM_EXPAND);
       /* Leave it be.  Resolution will happen in a later stage.  */
     }
   else
@@ -9027,51 +5351,44 @@
       rel->r_addend += ((sec->output_offset + fix->target_offset)
 			- (old_sec->output_offset + old_offset));
     }
-  return TRUE;
 }
 
 
 static void
-do_fix_for_final_link (Elf_Internal_Rela *rel,
-		       bfd *input_bfd,
-		       asection *input_section,
-		       bfd_byte *contents,
-		       bfd_vma *relocationp)
+do_fix_for_final_link (rel, input_section, relocationp)
+     Elf_Internal_Rela *rel;
+     asection *input_section;
+     bfd_vma *relocationp;
 {
   asection *sec;
   int r_type = ELF32_R_TYPE (rel->r_info);
+  reloc_bfd_fix *fix_list;
   reloc_bfd_fix *fix;
-  bfd_vma fixup_diff;
 
   if (r_type == R_XTENSA_NONE)
     return;
 
-  fix = get_bfd_fix (input_section, rel->r_offset, r_type);
-  if (!fix)
+  fix_list = (get_xtensa_relax_info (input_section))->fix_list;
+  if (fix_list == NULL)
+    return;
+
+  fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type);
+  if (fix == NULL)
     return;
 
   sec = fix->target_sec;
-
-  fixup_diff = rel->r_addend;
-  if (elf_howto_table[fix->src_type].partial_inplace)
-    {
-      bfd_vma inplace_val;
-      BFD_ASSERT (fix->src_offset
-		  < bfd_get_section_limit (input_bfd, input_section));
-      inplace_val = bfd_get_32 (input_bfd, &contents[fix->src_offset]);
-      fixup_diff += inplace_val;
-    }
-
   *relocationp = (sec->output_section->vma
 		  + sec->output_offset
-		  + fix->target_offset - fixup_diff);
+		  + fix->target_offset - rel->r_addend);
 }
 
 
 /* Miscellaneous utility functions....  */
 
 static asection *
-elf_xtensa_get_plt_section (bfd *dynobj, int chunk)
+elf_xtensa_get_plt_section (dynobj, chunk)
+     bfd *dynobj;
+     int chunk;
 {
   char plt_name[10];
 
@@ -9084,7 +5401,9 @@
 
 
 static asection *
-elf_xtensa_get_gotplt_section (bfd *dynobj, int chunk)
+elf_xtensa_get_gotplt_section (dynobj, chunk)
+     bfd *dynobj;
+     int chunk;
 {
   char got_name[14];
 
@@ -9105,11 +5424,13 @@
    . an absolute value, return the absolute section.  */
 
 static asection *
-get_elf_r_symndx_section (bfd *abfd, unsigned long r_symndx)
+get_elf_r_symndx_section (abfd, r_symndx)
+     bfd *abfd;
+     unsigned long r_symndx;
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   asection *target_sec = NULL;
-  if (r_symndx < symtab_hdr->sh_info)
+  if (r_symndx < symtab_hdr->sh_info) 
     {
       Elf_Internal_Sym *isymbuf;
       unsigned int section_index;
@@ -9125,7 +5446,7 @@
 	target_sec = bfd_abs_section_ptr;
       else if (section_index == SHN_COMMON)
 	target_sec = bfd_com_section_ptr;
-      else
+      else 
 	/* Who knows?  */
 	target_sec = NULL;
     }
@@ -9161,7 +5482,9 @@
 
 
 static struct elf_link_hash_entry *
-get_elf_r_symndx_hash_entry (bfd *abfd, unsigned long r_symndx)
+get_elf_r_symndx_hash_entry (abfd, r_symndx)
+     bfd *abfd;
+     unsigned long r_symndx;
 {
   unsigned long indx;
   struct elf_link_hash_entry *h;
@@ -9169,7 +5492,7 @@
 
   if (r_symndx < symtab_hdr->sh_info)
     return NULL;
-
+  
   indx = r_symndx - symtab_hdr->sh_info;
   h = elf_sym_hashes (abfd)[indx];
   while (h->root.type == bfd_link_hash_indirect
@@ -9182,12 +5505,14 @@
 /* Get the section-relative offset for a symbol number.  */
 
 static bfd_vma
-get_elf_r_symndx_offset (bfd *abfd, unsigned long r_symndx)
+get_elf_r_symndx_offset (abfd, r_symndx)
+     bfd *abfd;
+     unsigned long r_symndx;
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   bfd_vma offset = 0;
 
-  if (r_symndx < symtab_hdr->sh_info)
+  if (r_symndx < symtab_hdr->sh_info) 
     {
       Elf_Internal_Sym *isymbuf;
       isymbuf = retrieve_local_syms (abfd);
@@ -9211,51 +5536,35 @@
 
 
 static bfd_boolean
-is_reloc_sym_weak (bfd *abfd, Elf_Internal_Rela *rel)
+pcrel_reloc_fits (opnd, self_address, dest_address)
+     xtensa_operand opnd;
+     bfd_vma self_address;
+     bfd_vma dest_address;
 {
-  unsigned long r_symndx = ELF32_R_SYM (rel->r_info);
-  struct elf_link_hash_entry *h;
-
-  h = get_elf_r_symndx_hash_entry (abfd, r_symndx);
-  if (h && h->root.type == bfd_link_hash_defweak)
-    return TRUE;
-  return FALSE;
-}
-
-
-static bfd_boolean
-pcrel_reloc_fits (xtensa_opcode opc,
-		  int opnd,
-		  bfd_vma self_address,
-		  bfd_vma dest_address)
-{
-  xtensa_isa isa = xtensa_default_isa;
-  uint32 valp = dest_address;
-  if (xtensa_operand_do_reloc (isa, opc, opnd, &valp, self_address)
-      || xtensa_operand_encode (isa, opc, opnd, &valp))
-    return FALSE;
-  return TRUE;
+  uint32 new_address =
+    xtensa_operand_do_reloc (opnd, dest_address, self_address);
+  return (xtensa_operand_encode (opnd, &new_address)
+	  == xtensa_encode_result_ok);
 }
 
 
 static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
 static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1;
 static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1;
-static int prop_sec_len = sizeof (XTENSA_PROP_SEC_NAME) - 1;
 
 
 static bfd_boolean 
-xtensa_is_property_section (asection *sec)
+xtensa_is_property_section (sec)
+     asection *sec;
 {
   if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0
-      || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0
-      || strncmp (XTENSA_PROP_SEC_NAME, sec->name, prop_sec_len) == 0)
+      || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0)
     return TRUE;
 
   if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0
-      && (strncmp (&sec->name[linkonce_len], "x.", 2) == 0
-	  || strncmp (&sec->name[linkonce_len], "p.", 2) == 0
-	  || strncmp (&sec->name[linkonce_len], "prop.", 5) == 0))
+      && (sec->name[linkonce_len] == 'x'
+	  || sec->name[linkonce_len] == 'p')
+      && sec->name[linkonce_len + 1] == '.')
     return TRUE;
 
   return FALSE;
@@ -9263,7 +5572,8 @@
 
 
 static bfd_boolean 
-xtensa_is_littable_section (asection *sec)
+xtensa_is_littable_section (sec)
+     asection *sec;
 {
   if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0)
     return TRUE;
@@ -9277,70 +5587,58 @@
 }
 
 
-static int
-internal_reloc_compare (const void *ap, const void *bp)
+static bfd_boolean
+is_literal_section (sec)
+     asection *sec;
 {
-  const Elf_Internal_Rela *a = (const Elf_Internal_Rela *) ap;
-  const Elf_Internal_Rela *b = (const Elf_Internal_Rela *) bp;
-
-  if (a->r_offset != b->r_offset)
-    return (a->r_offset - b->r_offset);
-
-  /* We don't need to sort on these criteria for correctness,
-     but enforcing a more strict ordering prevents unstable qsort
-     from behaving differently with different implementations.
-     Without the code below we get correct but different results
-     on Solaris 2.7 and 2.8.  We would like to always produce the
-     same results no matter the host.  */
-
-  if (a->r_info != b->r_info)
-    return (a->r_info - b->r_info);
-
-  return (a->r_addend - b->r_addend);
+  /* FIXME: the current definition of this leaves a lot to be desired....  */
+  if (sec == NULL || sec->name == NULL)
+    return FALSE;
+  return (strstr (sec->name, "literal") != NULL);
 }
 
 
 static int
-internal_reloc_matches (const void *ap, const void *bp)
+internal_reloc_compare (ap, bp)
+     const PTR ap;
+     const PTR bp;
 {
   const Elf_Internal_Rela *a = (const Elf_Internal_Rela *) ap;
   const Elf_Internal_Rela *b = (const Elf_Internal_Rela *) bp;
 
-  /* Check if one entry overlaps with the other; this shouldn't happen
-     except when searching for a match.  */
   return (a->r_offset - b->r_offset);
 }
 
 
 char *
-xtensa_get_property_section_name (asection *sec, const char *base_name)
+xtensa_get_property_section_name (sec, base_name)
+     asection *sec;
+     const char *base_name;
 {
   if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0)
     {
       char *prop_sec_name;
       const char *suffix;
-      char *linkonce_kind = 0;
+      char linkonce_kind = 0;
 
       if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0) 
-	linkonce_kind = "x";
+	linkonce_kind = 'x';
       else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0) 
-	linkonce_kind = "p";
-      else if (strcmp (base_name, XTENSA_PROP_SEC_NAME) == 0)
-	linkonce_kind = "prop.";
+	linkonce_kind = 'p';
       else
 	abort ();
 
-      prop_sec_name = (char *) bfd_malloc (strlen (sec->name)
-					   + strlen (linkonce_kind) + 1);
+      prop_sec_name = (char *) bfd_malloc (strlen (sec->name) + 1);
       memcpy (prop_sec_name, ".gnu.linkonce.", linkonce_len);
-      strcpy (prop_sec_name + linkonce_len, linkonce_kind);
+      prop_sec_name[linkonce_len] = linkonce_kind;
+      prop_sec_name[linkonce_len + 1] = '.';
 
       suffix = sec->name + linkonce_len;
       /* For backward compatibility, replace "t." instead of inserting
-         the new linkonce_kind (but not for "prop" sections).  */
-      if (strncmp (suffix, "t.", 2) == 0 && linkonce_kind[1] == '.')
-        suffix += 2;
-      strcat (prop_sec_name + linkonce_len, suffix);
+	 the new linkonce_kind.  */
+      if (strncmp (suffix, "t.", 2) == 0)
+	suffix += 2;
+      strcpy (prop_sec_name + linkonce_len + 2, suffix);
 
       return prop_sec_name;
     }
@@ -9348,42 +5646,21 @@
   return strdup (base_name);
 }
 
-
-flagword
-xtensa_get_property_predef_flags (asection *sec)
-{
-  if (strcmp (sec->name, XTENSA_INSN_SEC_NAME) == 0
-      || strncmp (sec->name, ".gnu.linkonce.x.",
-		  sizeof ".gnu.linkonce.x." - 1) == 0)
-    return (XTENSA_PROP_INSN
-	    | XTENSA_PROP_INSN_NO_TRANSFORM
-	    | XTENSA_PROP_INSN_NO_REORDER);
-
-  if (xtensa_is_littable_section (sec))
-    return (XTENSA_PROP_LITERAL
-	    | XTENSA_PROP_INSN_NO_TRANSFORM
-	    | XTENSA_PROP_INSN_NO_REORDER);
-
-  return 0;
-}
-
 
 /* Other functions called directly by the linker.  */
 
 bfd_boolean
-xtensa_callback_required_dependence (bfd *abfd,
-				     asection *sec,
-				     struct bfd_link_info *link_info,
-				     deps_callback_t callback,
-				     void *closure)
+xtensa_callback_required_dependence (abfd, sec, link_info, callback, closure)
+     bfd *abfd;
+     asection *sec;
+     struct bfd_link_info *link_info;
+     deps_callback_t callback;
+     PTR closure;
 {
   Elf_Internal_Rela *internal_relocs;
   bfd_byte *contents;
   unsigned i;
   bfd_boolean ok = TRUE;
-  bfd_size_type sec_size;
-
-  sec_size = bfd_get_section_limit (abfd, sec);
 
   /* ".plt*" sections have no explicit relocations but they contain L32R
      instructions that reference the corresponding ".got.plt*" sections.  */
@@ -9411,43 +5688,43 @@
       /* Assume worst-case offsets: L32R at the very end of the ".plt"
 	 section referencing a literal at the very beginning of
 	 ".got.plt".  This is very close to the real dependence, anyway.  */
-      (*callback) (sec, sec_size, sgotplt, 0, closure);
+      (*callback) (sec, sec->size, sgotplt, 0, closure);
     }
 
   internal_relocs = retrieve_internal_relocs (abfd, sec, 
 					      link_info->keep_memory);
   if (internal_relocs == NULL
-      || sec->reloc_count == 0)
+      || sec->reloc_count == 0) 
     return ok;
 
   /* Cache the contents for the duration of this scan.  */
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
-  if (contents == NULL && sec_size != 0)
+  if (contents == NULL && sec->size != 0)
     {
       ok = FALSE;
       goto error_return;
     }
 
-  if (!xtensa_default_isa)
-    xtensa_default_isa = xtensa_isa_init (0, 0);
+  if (xtensa_default_isa == NULL)
+    xtensa_isa_init ();
 
-  for (i = 0; i < sec->reloc_count; i++)
+  for (i = 0; i < sec->reloc_count; i++) 
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
-      if (is_l32r_relocation (abfd, sec, contents, irel))
+      if (is_l32r_relocation (sec, contents, irel))
 	{
 	  r_reloc l32r_rel;
 	  asection *target_sec;
 	  bfd_vma target_offset;
-
-	  r_reloc_init (&l32r_rel, abfd, irel, contents, sec_size);
+	  
+	  r_reloc_init (&l32r_rel, abfd, irel);
 	  target_sec = NULL;
 	  target_offset = 0;
 	  /* L32Rs must be local to the input file.  */
 	  if (r_reloc_is_defined (&l32r_rel))
 	    {
 	      target_sec = r_reloc_get_section (&l32r_rel);
-	      target_offset = l32r_rel.target_offset;
+	      target_offset = r_reloc_get_target_offset (&l32r_rel);
 	    }
 	  (*callback) (sec, irel->r_offset, target_sec, target_offset,
 		       closure);
@@ -9484,7 +5761,7 @@
    value so that pre-T1040 tools can read the files.  As soon as we stop
    caring about pre-T1040 tools, the following two values should be
    swapped. At the same time, any other code that uses EM_XTENSA_OLD
-   should be changed to use EM_XTENSA.  */
+   (e.g., prep_headers() in elf.c) should be changed to use EM_XTENSA.  */
 #define ELF_MACHINE_CODE		EM_XTENSA_OLD
 #define ELF_MACHINE_ALT1		EM_XTENSA
 
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 8bc830c..800d66a 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1969,7 +1969,7 @@
      the original values (in elf64_hppa_link_output_symbol_hook).  */
   if (dyn_h && dyn_h->want_opd)
     {
-      BFD_ASSERT (sopd != NULL);
+      BFD_ASSERT (sopd != NULL)
 
       /* Save away the original value and section index so that we
 	 can restore them later.  */
@@ -1993,7 +1993,7 @@
       Elf_Internal_Rela rel;
       bfd_byte *loc;
 
-      BFD_ASSERT (splt != NULL && spltrel != NULL);
+      BFD_ASSERT (splt != NULL && spltrel != NULL)
 
       /* We do not actually care about the value in the PLT entry
 	 if we are creating a shared library and the symbol is
@@ -2043,7 +2043,7 @@
       int insn;
       unsigned int max_offset;
 
-      BFD_ASSERT (stub != NULL);
+      BFD_ASSERT (stub != NULL)
 
       /* Install the generic stub template.
 
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index dd68f70..ac9f96f 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -2352,8 +2352,6 @@
       sym = *ptr->sym_ptr_ptr;
       if (sym == last_sym)
 	n = last_sym_idx;
-      else if (bfd_is_abs_section (sym->section) && sym->value == 0)
-	n = STN_UNDEF;
       else
 	{
 	  last_sym = sym;
@@ -2450,8 +2448,6 @@
       sym = *ptr->sym_ptr_ptr;
       if (sym == last_sym)
 	n = last_sym_idx;
-      else if (bfd_is_abs_section (sym->section) && sym->value == 0)
-	n = STN_UNDEF;
       else
 	{
 	  last_sym = sym;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index f039fa7..8737f23 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2782,21 +2782,6 @@
   return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
 }
 
-/* Handle an x86-64 specific section when reading an object file.  This
-   is called when elfcode.h finds a section with an unknown type.  */
-
-static bfd_boolean
-elf64_x86_64_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)
-{
-  if (hdr->sh_type != SHT_X86_64_UNWIND)
-    return FALSE;
-
-  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
-    return FALSE;
-
-  return TRUE;
-}
-
 #define TARGET_LITTLE_SYM		    bfd_elf64_x86_64_vec
 #define TARGET_LITTLE_NAME		    "elf64-x86-64"
 #define ELF_ARCH			    bfd_arch_i386
@@ -2834,7 +2819,4 @@
 #define elf_backend_object_p		    elf64_x86_64_elf_object_p
 #define bfd_elf64_mkobject		    elf64_x86_64_mkobject
 
-#define elf_backend_section_from_shdr \
-	elf64_x86_64_section_from_shdr
-
 #include "elf64-target.h"
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 68435bb..8320fd8 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2,21 +2,21 @@
    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
-   This file is part of BFD, the Binary File Descriptor library.
+This file is part of BFD, the Binary File Descriptor library.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -629,7 +629,8 @@
 	  bfd *dynobj = elf_hash_table (info)->dynobj;
 
 	  if (dynobj != NULL
-	      && (ip = bfd_get_section_by_name (dynobj, p->name)) != NULL
+	      && (ip = bfd_get_section_by_name (dynobj, p->name))
+	      != NULL
 	      && (ip->flags & SEC_LINKER_CREATED)
 	      && ip->output_section == p)
 	    return TRUE;
@@ -708,7 +709,7 @@
 		       bfd_boolean *type_change_ok,
 		       bfd_boolean *size_change_ok)
 {
-  asection *sec, *oldsec;
+  asection *sec;
   struct elf_link_hash_entry *h;
   struct elf_link_hash_entry *flip;
   int bind;
@@ -752,31 +753,26 @@
       return TRUE;
     }
 
-  /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
-     existing symbol.  */
+  /* OLDBFD is a BFD associated with the existing symbol.  */
 
   switch (h->root.type)
     {
     default:
       oldbfd = NULL;
-      oldsec = NULL;
       break;
 
     case bfd_link_hash_undefined:
     case bfd_link_hash_undefweak:
       oldbfd = h->root.u.undef.abfd;
-      oldsec = NULL;
       break;
 
     case bfd_link_hash_defined:
     case bfd_link_hash_defweak:
       oldbfd = h->root.u.def.section->owner;
-      oldsec = h->root.u.def.section;
       break;
 
     case bfd_link_hash_common:
       oldbfd = h->root.u.c.p->section->owner;
-      oldsec = h->root.u.c.p->section;
       break;
     }
 
@@ -844,54 +840,6 @@
   else
     olddef = TRUE;
 
-  /* Check TLS symbol.  */
-  if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)
-      && ELF_ST_TYPE (sym->st_info) != h->type)
-    {
-      bfd *ntbfd, *tbfd;
-      bfd_boolean ntdef, tdef;
-      asection *ntsec, *tsec;
-
-      if (h->type == STT_TLS)
-	{
-	  ntbfd = abfd; 
-	  ntsec = sec;
-	  ntdef = newdef;
-	  tbfd = oldbfd;
-	  tsec = oldsec;
-	  tdef = olddef;
-	}
-      else
-	{
-	  ntbfd = oldbfd;
-	  ntsec = oldsec;
-	  ntdef = olddef;
-	  tbfd = abfd;
-	  tsec = sec;
-	  tdef = newdef;
-	}
-
-      if (tdef && ntdef)
-	(*_bfd_error_handler)
-	  (_("%s: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"),
-	   tbfd, tsec, ntbfd, ntsec, h->root.root.string);
-      else if (!tdef && !ntdef)
-	(*_bfd_error_handler)
-	  (_("%s: TLS reference in %B mismatches non-TLS reference in %B"),
-	   tbfd, ntbfd, h->root.root.string);
-      else if (tdef)
-	(*_bfd_error_handler)
-	  (_("%s: TLS definition in %B section %A mismatches non-TLS reference in %B"),
-	   tbfd, tsec, ntbfd, h->root.root.string);
-      else
-	(*_bfd_error_handler)
-	  (_("%s: TLS reference in %B mismatches non-TLS definition in %B section %A"),
-	   tbfd, ntbfd, ntsec, h->root.root.string);
-
-      bfd_set_error (bfd_error_bad_value);
-      return FALSE;
-    }
-
   /* We need to remember if a symbol has a definition in a dynamic
      object or is weak in all dynamic objects. Internal and hidden
      visibility will make it unavailable to dynamic objects.  */
@@ -2700,10 +2648,6 @@
   if (! is_elf_hash_table (hash_table))
     return FALSE;
 
-  if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL)
-    _bfd_error_handler
-      (_("warning: creating a DT_TEXTREL in a shared object."));
-
   bed = get_elf_backend_data (hash_table->dynobj);
   s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
   BFD_ASSERT (s != NULL);
@@ -3778,14 +3722,6 @@
 	    (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
 							dynamic);
 
-	  /* If this symbol has default visibility and the user has requested
-	     we not re-export it, then mark it as hidden.  */
-	  if (definition && !dynamic
-	      && (abfd->no_export
-		  || (abfd->my_archive && abfd->my_archive->no_export))
-	      && ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL)
-	    isym->st_other = STV_HIDDEN | (isym->st_other & ~ ELF_ST_VISIBILITY (-1));
-
 	  if (isym->st_other != 0 && !dynamic)
 	    {
 	      unsigned char hvis, symvis, other, nvis;
@@ -5719,14 +5655,6 @@
 	bfd_byte *erel, *erelend;
 	asection *o = lo->u.indirect.section;
 
-	if (o->contents == NULL && o->size != 0)
-	  {
-	    /* This is a reloc section that is being handled as a normal
-	       section.  See bfd_section_from_shdr.  We can't combine
-	       relocs in this case.  */
-	    free (sort);
-	    return 0;
-	  }
 	erel = o->contents;
 	erelend = o->contents + o->size;
 	p = sort + o->output_offset / ext_size * sort_elt;
@@ -6382,40 +6310,30 @@
   return FALSE;
 }
 
-enum action_discarded
-  {
-    COMPLAIN = 1,
-    PRETEND = 2
-  };
+/* Return TRUE if we should complain about a reloc in SEC against a
+   symbol defined in a discarded section.  */
 
-/* Return a mask saying how ld should treat relocations in SEC against
-   symbols defined in discarded sections.  If this function returns
-   COMPLAIN set, ld will issue a warning message.  If this function
-   returns PRETEND set, and the discarded section was link-once and the
-   same size as the kept link-once section, ld will pretend that the
-   symbol was actually defined in the kept section.  Otherwise ld will
-   zero the reloc (at least that is the intent, but some cooperation by
-   the target dependent code is needed, particularly for REL targets).  */
-
-static unsigned int
-elf_action_discarded (asection *sec)
+static bfd_boolean
+elf_section_complain_discarded (asection *sec)
 {
-  if (sec->flags & SEC_DEBUGGING)
-    return PRETEND;
+  if (strncmp (".stab", sec->name, 5) == 0
+      && (!sec->name[5] ||
+	  (sec->name[5] == '.' && ISDIGIT (sec->name[6]))))
+    return FALSE;
 
   if (strcmp (".eh_frame", sec->name) == 0)
-    return 0;
+    return FALSE;
 
   if (strcmp (".gcc_except_table", sec->name) == 0)
-    return 0;
+    return FALSE;
 
   if (strcmp (".PARISC.unwind", sec->name) == 0)
-    return 0;
+    return FALSE;
 
   if (strcmp (".fixup", sec->name) == 0)
-    return 0;
+    return FALSE;
 
-  return COMPLAIN | PRETEND;
+  return TRUE;
 }
 
 /* Find a match between a section and a member of a section group.  */
@@ -6710,7 +6628,7 @@
 	  if (!elf_section_ignore_discarded_relocs (o))
 	    {
 	      Elf_Internal_Rela *rel, *relend;
-	      unsigned int action = elf_action_discarded (o);
+	      bfd_boolean complain = elf_section_complain_discarded (o);
 
 	      rel = internal_relocs;
 	      relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
@@ -6751,10 +6669,44 @@
 		     discarded section.  */
 		  if ((sec = *ps) != NULL && elf_discarded_section (sec))
 		    {
-		      asection *kept;
+		      if ((o->flags & SEC_DEBUGGING) != 0)
+			{
+			  BFD_ASSERT (r_symndx != 0);
 
-		      BFD_ASSERT (r_symndx != 0);
-		      if (action & COMPLAIN)
+			  /* Try to preserve debug information.
+			     FIXME: This is quite broken.  Modifying
+			     the symbol here means we will be changing
+			     all uses of the symbol, not just those in
+			     debug sections.  The only thing that makes
+			     this half reasonable is that debug sections
+			     tend to come after other sections.  Of
+			     course, that doesn't help with globals.
+			     ??? All link-once sections of the same name
+			     ought to define the same set of symbols, so
+			     it would seem that globals ought to always
+			     be defined in the kept section.  */
+			  if (sec->kept_section != NULL)
+			    {
+			      asection *member;
+
+			      /* Check if it is a linkonce section or
+				 member of a comdat group.  */
+			      if (elf_sec_group (sec) == NULL
+				  && sec->size == sec->kept_section->size)
+				{
+				  *ps = sec->kept_section;
+				  continue;
+				}
+			      else if (elf_sec_group (sec) != NULL
+				       && (member = match_group_member (sec, sec->kept_section))
+				       && sec->size == member->size)
+				{
+				  *ps = member;
+				  continue;
+				}
+			    }
+			}
+		      else if (complain)
 			{
 			  (*_bfd_error_handler)
 			    (_("`%s' referenced in section `%A' of %B: "
@@ -6762,30 +6714,6 @@
 			     o, input_bfd, sec, sec->owner, sym_name);
 			}
 
-		      /* Try to do the best we can to support buggy old
-			 versions of gcc.  If we've warned, or this is
-			 debugging info, pretend that the symbol is
-			 really defined in the kept linkonce section.
-			 FIXME: This is quite broken.  Modifying the
-			 symbol here means we will be changing all later
-			 uses of the symbol, not just in this section.
-			 The only thing that makes this half reasonable
-			 is that we warn in non-debug sections, and
-			 debug sections tend to come after other
-			 sections.  */
-		      kept = sec->kept_section;
-		      if (kept != NULL && (action & PRETEND))
-			{
-			  if (elf_sec_group (sec) != NULL)
-			    kept = match_group_member (sec, kept);
-			  if (kept != NULL
-			      && sec->size == kept->size)
-			    {
-			      *ps = kept;
-			      continue;
-			    }
-			}
-
 		      /* Remove the symbol reference from the reloc, but
 			 don't kill the reloc completely.  This is so that
 			 a zero value will be written into the section,
@@ -9276,11 +9204,88 @@
   return ret;
 }
 
+struct already_linked_section
+{
+  asection *sec;
+  asection *linked;
+};
+
+/* Check if the member of a single member comdat group matches a
+   linkonce section and vice versa.  */
+static bfd_boolean
+try_match_symbols_in_sections
+  (struct bfd_section_already_linked_hash_entry *h, void *info)
+{
+  struct bfd_section_already_linked *l;
+  struct already_linked_section *s
+    = (struct already_linked_section *) info;
+
+  if (elf_sec_group (s->sec) == NULL)
+    {
+      /* It is a linkonce section. Try to match it with the member of a
+	 single member comdat group. */
+      for (l = h->entry; l != NULL; l = l->next)
+	if ((l->sec->flags & SEC_GROUP))
+	  {
+	    asection *first = elf_next_in_group (l->sec);
+
+	    if (first != NULL
+		&& elf_next_in_group (first) == first
+		&& bfd_elf_match_symbols_in_sections (first, s->sec))
+	      {
+		s->linked = first;
+		return FALSE;
+	      }
+	  }
+    }
+  else
+    {
+      /* It is the member of a single member comdat group. Try to match
+	 it with a linkonce section.  */
+      for (l = h->entry; l != NULL; l = l->next)
+	if ((l->sec->flags & SEC_GROUP) == 0
+	    && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
+	    && bfd_elf_match_symbols_in_sections (l->sec, s->sec))
+	  {
+	    s->linked = l->sec;
+	    return FALSE;
+	  }
+    }
+
+  return TRUE;
+}
+
+static bfd_boolean
+already_linked (asection *sec, asection *group)
+{
+  struct already_linked_section result;
+
+  result.sec = sec;
+  result.linked = NULL;
+
+  bfd_section_already_linked_table_traverse
+    (try_match_symbols_in_sections, &result);
+
+  if (result.linked)
+    {
+      sec->output_section = bfd_abs_section_ptr;
+      sec->kept_section = result.linked;
+
+      /* Also discard the group section.  */
+      if (group)
+	group->output_section = bfd_abs_section_ptr;
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 void
 _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
 {
   flagword flags;
-  const char *name, *p;
+  const char *name;
   struct bfd_section_already_linked *l;
   struct bfd_section_already_linked_hash_entry *already_linked_list;
   asection *group;
@@ -9330,13 +9335,7 @@
 
   name = bfd_get_section_name (abfd, sec);
 
-  if (strncmp (name, ".gnu.linkonce.", sizeof (".gnu.linkonce.") - 1) == 0
-      && (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
-    p++;
-  else
-    p = name;
-
-  already_linked_list = bfd_section_already_linked_table_lookup (p);
+  already_linked_list = bfd_section_already_linked_table_lookup (name);
 
   for (l = already_linked_list->entry; l != NULL; l = l->next)
     {
@@ -9346,11 +9345,10 @@
 	 a linkonce section with a linkonce section, and ignore comdat
 	 section.  */
       if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP)
-	  && strcmp (name, l->sec->name) == 0
 	  && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL)
 	{
 	  /* The section has already been linked.  See if we should
-	     issue a warning.  */
+             issue a warning.  */
 	  switch (flags & SEC_LINK_DUPLICATES)
 	    {
 	    default:
@@ -9439,39 +9437,15 @@
 	 section. We only record the discarded comdat group. Otherwise
 	 the undiscarded group will be discarded incorrectly later since
 	 itself has been recorded.  */
-      for (l = already_linked_list->entry; l != NULL; l = l->next)
-	if ((l->sec->flags & SEC_GROUP) == 0
-	    && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
-	    && bfd_elf_match_symbols_in_sections (l->sec,
-						  elf_next_in_group (sec)))
-	  {
-	    elf_next_in_group (sec)->output_section = bfd_abs_section_ptr;
-	    elf_next_in_group (sec)->kept_section = l->sec;
-	    group->output_section = bfd_abs_section_ptr;
-	    break;
-	  }
-      if (l == NULL)
+      if (! already_linked (elf_next_in_group (sec), group))
 	return;
     }
   else
     /* There is no direct match. But for linkonce section, we should
        check if there is a match with comdat group member. We always
        record the linkonce section, discarded or not.  */
-    for (l = already_linked_list->entry; l != NULL; l = l->next)
-      if (l->sec->flags & SEC_GROUP)
-	{
-	  asection *first = elf_next_in_group (l->sec);
-
-	  if (first != NULL
-	      && elf_next_in_group (first) == first
-	      && bfd_elf_match_symbols_in_sections (first, sec))
-	    {
-	      sec->output_section = bfd_abs_section_ptr;
-	      sec->kept_section = l->sec;
-	      break;
-	    }
-	}
-
+    already_linked (sec, group);
+  
   /* This is the first section with this name.  Record it.  */
   bfd_section_already_linked_table_insert (already_linked_list, sec);
 }
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 093adbc..69ec779 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -924,7 +924,7 @@
 	     location of interest is just "sym".  */
 	   if (symtype == STT_SECTION)
 	     toff += irel->r_addend;
-
+	   
 	   toff = _bfd_merged_section_offset (abfd, &tsec,
 					      elf_section_data (tsec)->sec_info,
 					      toff);
@@ -1125,7 +1125,7 @@
      enough that the data segment moves, which will change the GP.
      Reset the GP so that we re-calculate next round.  We need to
      do this at the _beginning_ of the next round; now will not do.  */
-
+      
   /* Clean up and go home.  */
   while (fixups)
     {
@@ -2458,7 +2458,7 @@
 	      if (!pltoff)
 		return FALSE;
 	    }
-
+	  
 	  dyn_i->want_pltoff = 1;
 	}
       if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC))
@@ -4178,7 +4178,7 @@
 	    dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
 	    if (dyn_i->want_fptr)
 	      {
-		BFD_ASSERT (h == NULL || h->dynindx == -1);
+		BFD_ASSERT (h == NULL || h->dynindx == -1)
 	        if (!undef_weak_ref)
 	          value = set_fptr_entry (output_bfd, info, dyn_i, value);
 		dynindx = -1;
@@ -4262,7 +4262,7 @@
 	case R_IA64_PCREL64I:
 	  /* The PCREL21BI reloc is specifically not intended for use with
 	     dynamic relocs.  PCREL21F and PCREL21M are used for speculation
-	     fixup code, and thus probably ought not be dynamic.  The
+	     fixup code, and thus probably ought not be dynamic.  The 
 	     PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs.  */
 	  if (dynamic_symbol_p)
 	    {
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 81202f8..18a8d0f 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -188,10 +188,6 @@
 #ifndef bfd_elfNN_bfd_is_local_label_name
 #define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
 #endif
-#ifndef bfd_elfNN_bfd_is_target_special_symbol
-#define bfd_elfNN_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#endif
 
 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
diff --git a/bfd/hash.c b/bfd/hash.c
index 2b06b92..2954ec8 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -504,12 +504,12 @@
 void
 bfd_hash_set_default_size (bfd_size_type hash_size)
 {
+  int index;
   /* Extend this prime list if you want more granularity of hash table size.  */
-  static const bfd_size_type hash_size_primes[] =
+  static bfd_size_type hash_size_primes[] =
     {
       1021, 4051, 8599, 16699
     };
-  size_t index;
 
   /* Work out best prime number near the hash_size.  */
   for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index a1a7baa..aedcef0 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -193,7 +193,6 @@
 #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info
 #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line
 #define msdos_get_lineno _bfd_nosymbols_get_lineno
-#define msdos_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
 #define msdos_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
 #define msdos_read_minisymbols _bfd_nosymbols_read_minisymbols
diff --git a/bfd/ieee.c b/bfd/ieee.c
index c16a1ed..aaf1f11 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -4018,8 +4018,6 @@
 #define ieee_update_armap_timestamp bfd_true
 #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
 
-#define ieee_bfd_is_target_special_symbol  \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define ieee_get_lineno _bfd_nosymbols_get_lineno
 #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
diff --git a/bfd/ihex.c b/bfd/ihex.c
index c692b03..1392178 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -968,7 +968,6 @@
 #define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
 #define ihex_print_symbol _bfd_nosymbols_print_symbol
 #define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
-#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
 #define ihex_get_lineno _bfd_nosymbols_get_lineno
 #define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/libaout.h b/bfd/libaout.h
index ef9eae1..a762895 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -606,11 +606,6 @@
 #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
 #endif
 
-#ifndef aout_32_bfd_is_target_special_symbol
-#define aout_32_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#endif
-
 #ifndef WRITE_HEADERS
 #define WRITE_HEADERS(abfd, execp)					      \
       {									      \
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 86e6942..7b6ca76 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -299,8 +299,6 @@
   ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
 #define _bfd_nosymbols_bfd_is_local_label_name \
   ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
-#define _bfd_nosymbols_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define _bfd_nosymbols_get_lineno \
   ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
 #define _bfd_nosymbols_find_nearest_line \
@@ -595,10 +593,10 @@
   (const char*,int);
 
 #define BFD_ASSERT(x) \
-  do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
+  { if (!(x)) bfd_assert(__FILE__,__LINE__); }
 
 #define BFD_FAIL() \
-  do { bfd_assert(__FILE__,__LINE__); } while (0)
+  { bfd_assert(__FILE__,__LINE__); }
 
 extern void _bfd_abort
   (const char *, int, const char *) ATTRIBUTE_NORETURN;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index c308d88..abe6a2a 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -304,8 +304,6 @@
   ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
 #define _bfd_nosymbols_bfd_is_local_label_name \
   ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
-#define _bfd_nosymbols_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define _bfd_nosymbols_get_lineno \
   ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
 #define _bfd_nosymbols_find_nearest_line \
@@ -600,10 +598,10 @@
   (const char*,int);
 
 #define BFD_ASSERT(x) \
-  do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
+  { if (!(x)) bfd_assert(__FILE__,__LINE__); }
 
 #define BFD_FAIL() \
-  do { bfd_assert(__FILE__,__LINE__); } while (0)
+  { bfd_assert(__FILE__,__LINE__); }
 
 extern void _bfd_abort
   (const char *, int, const char *) ATTRIBUTE_NORETURN;
@@ -1113,7 +1111,6 @@
   "BFD_RELOC_ARM_ADRL_IMMEDIATE",
   "BFD_RELOC_ARM_OFFSET_IMM",
   "BFD_RELOC_ARM_SHIFT_IMM",
-  "BFD_RELOC_ARM_SMI",
   "BFD_RELOC_ARM_SWI",
   "BFD_RELOC_ARM_MULTI",
   "BFD_RELOC_ARM_CP_OFF_IMM",
@@ -1652,39 +1649,6 @@
   "BFD_RELOC_XTENSA_JMP_SLOT",
   "BFD_RELOC_XTENSA_RELATIVE",
   "BFD_RELOC_XTENSA_PLT",
-  "BFD_RELOC_XTENSA_DIFF8",
-  "BFD_RELOC_XTENSA_DIFF16",
-  "BFD_RELOC_XTENSA_DIFF32",
-  "BFD_RELOC_XTENSA_SLOT0_OP",
-  "BFD_RELOC_XTENSA_SLOT1_OP",
-  "BFD_RELOC_XTENSA_SLOT2_OP",
-  "BFD_RELOC_XTENSA_SLOT3_OP",
-  "BFD_RELOC_XTENSA_SLOT4_OP",
-  "BFD_RELOC_XTENSA_SLOT5_OP",
-  "BFD_RELOC_XTENSA_SLOT6_OP",
-  "BFD_RELOC_XTENSA_SLOT7_OP",
-  "BFD_RELOC_XTENSA_SLOT8_OP",
-  "BFD_RELOC_XTENSA_SLOT9_OP",
-  "BFD_RELOC_XTENSA_SLOT10_OP",
-  "BFD_RELOC_XTENSA_SLOT11_OP",
-  "BFD_RELOC_XTENSA_SLOT12_OP",
-  "BFD_RELOC_XTENSA_SLOT13_OP",
-  "BFD_RELOC_XTENSA_SLOT14_OP",
-  "BFD_RELOC_XTENSA_SLOT0_ALT",
-  "BFD_RELOC_XTENSA_SLOT1_ALT",
-  "BFD_RELOC_XTENSA_SLOT2_ALT",
-  "BFD_RELOC_XTENSA_SLOT3_ALT",
-  "BFD_RELOC_XTENSA_SLOT4_ALT",
-  "BFD_RELOC_XTENSA_SLOT5_ALT",
-  "BFD_RELOC_XTENSA_SLOT6_ALT",
-  "BFD_RELOC_XTENSA_SLOT7_ALT",
-  "BFD_RELOC_XTENSA_SLOT8_ALT",
-  "BFD_RELOC_XTENSA_SLOT9_ALT",
-  "BFD_RELOC_XTENSA_SLOT10_ALT",
-  "BFD_RELOC_XTENSA_SLOT11_ALT",
-  "BFD_RELOC_XTENSA_SLOT12_ALT",
-  "BFD_RELOC_XTENSA_SLOT13_ALT",
-  "BFD_RELOC_XTENSA_SLOT14_ALT",
   "BFD_RELOC_XTENSA_OP0",
   "BFD_RELOC_XTENSA_OP1",
   "BFD_RELOC_XTENSA_OP2",
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index 495be63..b809f3a 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -272,8 +272,6 @@
 #define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index
 #define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
 #define _bfd_ecoff_update_armap_timestamp bfd_true
-#define _bfd_ecoff_bfd_is_target_special_symbol  \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 
 extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
 extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation));
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 19a19d4..c4c05ab 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -44,8 +44,6 @@
 #define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook
 #define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
 #define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
-#define bfd_mach_o_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
-#define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
 #define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno
 #define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line
 #define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
diff --git a/bfd/mmo.c b/bfd/mmo.c
index a7745c1..1b7eb86 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3255,8 +3255,6 @@
 /* Perhaps we need to adjust this one; mmo labels (originally) without a
    leading ':' might more appropriately be called local.  */
 #define mmo_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define mmo_bfd_is_target_special_symbol  \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 
 /* Is this one really used or defined by anyone?  */
 #define mmo_get_lineno _bfd_nosymbols_get_lineno
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 1c727ed..30ae4b1 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -26,8 +26,6 @@
 #define nlm_print_symbol nlmNAME(print_symbol)
 #define nlm_get_symbol_info nlmNAME(get_symbol_info)
 #define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define nlm_bfd_is_target_special_symbol  \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define nlm_get_lineno _bfd_nosymbols_get_lineno
 #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
 #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 16f6b6d..c99919a 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1489,7 +1489,6 @@
 #define oasys_update_armap_timestamp bfd_true
 
 #define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define oasys_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define oasys_get_lineno _bfd_nosymbols_get_lineno
 #define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
 #define oasys_read_minisymbols _bfd_generic_read_minisymbols
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 627364c..e54e099 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -859,9 +859,9 @@
 }
 
 
-/*
-   GNU Extension: separate debug-info files
-
+/* 
+   GNU Extension: separate debug-info files 
+   
    The idea here is that a special section called .gnu_debuglink might be
    embedded in a binary file, which indicates that some *other* file
    contains the real debugging information. This special section contains a
@@ -889,7 +889,7 @@
 
 RETURNS
 	Return the updated CRC32 value.
-*/
+*/     
 
 unsigned long
 bfd_calc_gnu_debuglink_crc32 (unsigned long crc,
@@ -1092,19 +1092,19 @@
       return NULL;
     }
   BFD_ASSERT (strlen (dir) != 0);
-
+  
   /* Strip off filename part.  */
   for (i = strlen (dir) - 1; i >= 0; i--)
     if (IS_DIR_SEPARATOR (dir[i]))
       break;
 
   dir[i + 1] = '\0';
-  BFD_ASSERT (dir[i] == '/' || dir[0] == '\0');
+  BFD_ASSERT (dir[i] == '/' || dir[0] == '\0')
 
   debugfile = malloc (strlen (debug_file_directory) + 1
 		      + strlen (dir)
 		      + strlen (".debug/")
-		      + strlen (basename)
+		      + strlen (basename) 
 		      + 1);
   if (debugfile == NULL)
     {
@@ -1211,7 +1211,7 @@
 
 RETURNS
 	A pointer to the new section is returned if all is ok.  Otherwise <<NULL>> is
-	returned and bfd_error is set.
+	returned and bfd_error is set.  
 */
 
 asection *
@@ -1228,7 +1228,7 @@
 
   /* Strip off any path components in filename.  */
   filename = lbasename (filename);
-
+  
   sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
   if (sect)
     {
@@ -1246,7 +1246,7 @@
     /* XXX Should we delete the section from the bfd ?  */
     return NULL;
 
-
+  
   debuglink_size = strlen (filename) + 1;
   debuglink_size += 3;
   debuglink_size &= ~3;
@@ -1255,7 +1255,7 @@
   if (! bfd_set_section_size (abfd, sect, debuglink_size))
     /* XXX Should we delete the section from the bfd ?  */
     return NULL;
-
+  
   return sect;
 }
 
@@ -1277,7 +1277,7 @@
 
 RETURNS
 	<<TRUE>> is returned if all is ok.  Otherwise <<FALSE>> is returned
-	and bfd_error is set.
+	and bfd_error is set.  
 */
 
 bfd_boolean
@@ -1320,7 +1320,7 @@
   /* Strip off any path components in filename,
      now that we no longer need them.  */
   filename = lbasename (filename);
-
+  
   debuglink_size = strlen (filename) + 1;
   debuglink_size += 3;
   debuglink_size &= ~3;
diff --git a/bfd/pe-i386.c b/bfd/pe-i386.c
index d78970d..be691fd 100644
--- a/bfd/pe-i386.c
+++ b/bfd/pe-i386.c
@@ -34,8 +34,6 @@
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_EXACT_MATCH (".data"), \
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
-  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_EXACT_MATCH (".text"), \
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
diff --git a/bfd/pef.c b/bfd/pef.c
index 9bb3a76..b52ae65 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -37,7 +37,6 @@
 #define bfd_pef_bfd_free_cached_info                _bfd_generic_bfd_free_cached_info
 #define bfd_pef_new_section_hook                    _bfd_generic_new_section_hook
 #define bfd_pef_bfd_is_local_label_name             bfd_generic_is_local_label_name
-#define bfd_pef_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define bfd_pef_get_lineno                          _bfd_nosymbols_get_lineno
 #define bfd_pef_find_nearest_line                   _bfd_nosymbols_find_nearest_line
 #define bfd_pef_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c
index 4b36213..4a59f14 100644
--- a/bfd/pei-i386.c
+++ b/bfd/pei-i386.c
@@ -35,8 +35,6 @@
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_EXACT_MATCH (".data"), \
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
-{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
-  COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_EXACT_MATCH (".text"), \
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
 { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 3444caa..49f8140 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -345,8 +345,6 @@
   bfd_symbol_info (symbol, ret);
 }
 
-#define ppcboot_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define ppcboot_get_lineno _bfd_nosymbols_get_lineno
 #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 1df1840..8356b60 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2560,8 +2560,6 @@
 ENUMX
   BFD_RELOC_ARM_SHIFT_IMM
 ENUMX
-  BFD_RELOC_ARM_SMI
-ENUMX
   BFD_RELOC_ARM_SWI
 ENUMX
   BFD_RELOC_ARM_MULTI
@@ -4143,95 +4141,15 @@
   Xtensa relocation used in ELF object files for symbols that may require
   PLT entries.  Otherwise, this is just a generic 32-bit relocation.
 ENUM
-  BFD_RELOC_XTENSA_DIFF8
-ENUMX
-  BFD_RELOC_XTENSA_DIFF16
-ENUMX
-  BFD_RELOC_XTENSA_DIFF32
-ENUMDOC
-  Xtensa relocations to mark the difference of two local symbols.
-  These are only needed to support linker relaxation and can be ignored
-  when not relaxing.  The field is set to the value of the difference
-  assuming no relaxation.  The relocation encodes the position of the
-  first symbol so the linker can determine whether to adjust the field
-  value.
-ENUM
-  BFD_RELOC_XTENSA_SLOT0_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT1_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT2_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT3_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT4_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT5_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT6_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT7_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT8_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT9_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT10_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT11_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT12_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT13_OP
-ENUMX
-  BFD_RELOC_XTENSA_SLOT14_OP
-ENUMDOC
-  Generic Xtensa relocations for instruction operands.  Only the slot
-  number is encoded in the relocation.  The relocation applies to the
-  last PC-relative immediate operand, or if there are no PC-relative
-  immediates, to the last immediate operand.
-ENUM
-  BFD_RELOC_XTENSA_SLOT0_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT1_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT2_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT3_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT4_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT5_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT6_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT7_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT8_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT9_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT10_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT11_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT12_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT13_ALT
-ENUMX
-  BFD_RELOC_XTENSA_SLOT14_ALT
-ENUMDOC
-  Alternate Xtensa relocations.  Only the slot is encoded in the
-  relocation.  The meaning of these relocations is opcode-specific.
-ENUM
   BFD_RELOC_XTENSA_OP0
 ENUMX
   BFD_RELOC_XTENSA_OP1
 ENUMX
   BFD_RELOC_XTENSA_OP2
 ENUMDOC
-  Xtensa relocations for backward compatibility.  These have all been
-  replaced by BFD_RELOC_XTENSA_SLOT0_OP.
+  Generic Xtensa relocations.  Only the operand number is encoded
+  in the relocation.  The details are determined by extracting the
+  instruction opcode.
 ENUM
   BFD_RELOC_XTENSA_ASM_EXPAND
 ENUMDOC
diff --git a/bfd/simple.c b/bfd/simple.c
index 41aa950..5039911 100644
--- a/bfd/simple.c
+++ b/bfd/simple.c
@@ -92,12 +92,8 @@
   struct saved_output_info *output_info = ptr;
   output_info[section->index].offset = section->output_offset;
   output_info[section->index].section = section->output_section;
-  if ((section->flags & SEC_DEBUGGING) != 0
-      || section->output_section == NULL)
-    {
-      section->output_offset = 0;
-      section->output_section = section;
-    }
+  section->output_offset = 0;
+  section->output_section = section;
 }
 
 static void
@@ -121,10 +117,13 @@
 DESCRIPTION
 	Returns the relocated contents of section @var{sec}.  The symbols in
 	@var{symbol_table} will be used, or the symbols from @var{abfd} if
-	@var{symbol_table} is NULL.  The output offsets for debug sections will
+	@var{symbol_table} is NULL.  The output offsets for all sections will
 	be temporarily reset to 0.  The result will be stored at @var{outbuf}
 	or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}.
 
+	Generally all sections in @var{abfd} should have their
+	@code{output_section} pointing back to the original section.
+
 	Returns @code{NULL} on a fatal error; ignores errors applying
 	particular relocations.
 */
diff --git a/bfd/som.c b/bfd/som.c
index 879e0b7..c35b344 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6402,8 +6402,6 @@
 #define som_update_armap_timestamp	bfd_true
 #define som_bfd_print_private_bfd_data  _bfd_generic_bfd_print_private_bfd_data
 
-#define som_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define som_get_lineno			_bfd_nosymbols_get_lineno
 #define som_bfd_make_debug_symbol	_bfd_nosymbols_bfd_make_debug_symbol
 #define som_read_minisymbols		_bfd_generic_read_minisymbols
diff --git a/bfd/srec.c b/bfd/srec.c
index e184a20..19dfaa9 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1262,7 +1262,6 @@
 #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
 #define srec_new_section_hook _bfd_generic_new_section_hook
 
-#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define srec_get_lineno _bfd_nosymbols_get_lineno
 #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/syms.c b/bfd/syms.c
index 245369d..6b615a2 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -355,7 +355,7 @@
   /* The BSF_SECTION_SYM check is needed for IA-64, where every label that
      starts with '.' is local.  This would accidentally catch section names
      if we didn't reject them here.  */
-  if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_FILE | BSF_SECTION_SYM)) != 0)
+  if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_SECTION_SYM)) != 0)
     return FALSE;
   if (sym->name == NULL)
     return FALSE;
@@ -382,23 +382,6 @@
 
 /*
 FUNCTION
-	bfd_is_target_special_symbol
-
-SYNOPSIS
-        bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
-
-DESCRIPTION
-	Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
-	special to the particular target represented by the BFD.  Such symbols
-	should normally not be mentioned to the user.
-
-.#define bfd_is_target_special_symbol(abfd, sym) \
-.  BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-.
-*/
-
-/*
-FUNCTION
 	bfd_canonicalize_symtab
 
 DESCRIPTION
@@ -1033,10 +1016,6 @@
 	      asymbol *sym;
 
 	      r = *pr;
-	      /* Ignore R_*_NONE relocs.  */
-	      if (r->howto->dst_mask == 0)
-		continue;
-
 	      if (r->howto->rightshift != 0
 		  || r->howto->size != 2
 		  || r->howto->bitsize != 32
diff --git a/bfd/targets.c b/bfd/targets.c
index 6b5c00c..05832d8 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -338,7 +338,6 @@
 .  NAME##_print_symbol, \
 .  NAME##_get_symbol_info, \
 .  NAME##_bfd_is_local_label_name, \
-.  NAME##_bfd_is_target_special_symbol, \
 .  NAME##_get_lineno, \
 .  NAME##_find_nearest_line, \
 .  NAME##_bfd_make_debug_symbol, \
@@ -357,7 +356,7 @@
 .    (bfd *, struct bfd_symbol *, symbol_info *);
 .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
 .  bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-.  bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
+.
 .  alent *     (*_get_lineno) (bfd *, struct bfd_symbol *);
 .  bfd_boolean (*_bfd_find_nearest_line)
 .    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index df1dab5..a7a9254 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -989,7 +989,6 @@
 #define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
 #define tekhex_new_section_hook _bfd_generic_new_section_hook
 
-#define tekhex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define tekhex_get_lineno _bfd_nosymbols_get_lineno
 #define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/versados.c b/bfd/versados.c
index 68678c8..50b3487 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -855,8 +855,6 @@
 #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
 #define versados_new_section_hook _bfd_generic_new_section_hook
 
-#define versados_bfd_is_target_special_symbol \
-  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define versados_get_lineno _bfd_nosymbols_get_lineno
 #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
diff --git a/bfd/version.h b/bfd/version.h
index 2f0befa..df343d7 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20041018
+#define BFD_VERSION_DATE 20040921
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING @bfd_version_string@
diff --git a/bfd/vms.c b/bfd/vms.c
index 15ab5b0..640d0eb 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -164,7 +164,6 @@
 static bfd_boolean vms_bfd_set_private_flags
   PARAMS ((bfd *abfd, flagword flags));
 
-#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define vms_make_empty_symbol _bfd_generic_make_empty_symbol
 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
 #define vms_bfd_is_group_section bfd_generic_is_group_section
diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h
index 78de54a..9b80e3c 100644
--- a/bfd/xcoff-target.h
+++ b/bfd/xcoff-target.h
@@ -43,7 +43,6 @@
 #define coff_mkobject _bfd_xcoff_mkobject
 #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
 #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
-#define coff_bfd_is_target_special_symbol  ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
 #define coff_relocate_section _bfd_ppc_xcoff_relocate_section
 
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 252be99..3c4c84d 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -27,7 +27,6 @@
 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
index 30ad80c..761e5c6 100644
--- a/bfd/xtensa-isa.c
+++ b/bfd/xtensa-isa.c
@@ -1,5 +1,5 @@
 /* Configurable Xtensa ISA support.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -17,78 +17,481 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+
 #include "xtensa-isa.h"
 #include "xtensa-isa-internal.h"
 
-xtensa_isa_status xtisa_errno;
-char xtisa_error_msg[1024];
+xtensa_isa xtensa_default_isa = NULL;
 
-
-xtensa_isa_status
-xtensa_isa_errno (xtensa_isa isa __attribute__ ((unused)))
+static int
+opname_lookup_compare (const void *v1, const void *v2)
 {
-  return xtisa_errno;
+  opname_lookup_entry *e1 = (opname_lookup_entry *)v1;
+  opname_lookup_entry *e2 = (opname_lookup_entry *)v2;
+
+  return strcmp (e1->key, e2->key);
 }
 
 
-char *
-xtensa_isa_error_msg (xtensa_isa isa __attribute__ ((unused)))
+xtensa_isa
+xtensa_isa_init (void)
 {
-  return xtisa_error_msg;
+  xtensa_isa isa;
+  int mod;
+
+  isa = xtensa_load_isa (0);
+  if (isa == 0)
+    {
+      fprintf (stderr, "Failed to initialize Xtensa base ISA module\n");
+      return NULL;
+    }
+
+  for (mod = 1; xtensa_isa_modules[mod].get_num_opcodes_fn; mod++)
+    {
+      if (!xtensa_extend_isa (isa, mod))
+	{
+	  fprintf (stderr, "Failed to initialize Xtensa TIE ISA module\n");
+	  return NULL;
+	}
+    }
+
+  return isa;
+}
+
+/* ISA information.  */
+
+static int
+xtensa_check_isa_config (xtensa_isa_internal *isa,
+			 struct config_struct *config_table)
+{
+  int i, j;
+
+  if (!config_table)
+    {
+      fprintf (stderr, "Error: Empty configuration table in ISA DLL\n");
+      return 0;
+    }
+
+  /* For the first module, save a pointer to the table and record the
+     specified endianness and availability of the density option.  */
+
+  if (isa->num_modules == 0)
+    {
+      int found_memory_order = 0;
+
+      isa->config = config_table;
+      isa->has_density = 1;  /* Default to have density option.  */
+
+      for (i = 0; config_table[i].param_name; i++)
+	{
+	  if (!strcmp (config_table[i].param_name, "IsaMemoryOrder"))
+	    {
+	      isa->is_big_endian =
+		(strcmp (config_table[i].param_value, "BigEndian") == 0);
+	      found_memory_order = 1;
+	    }
+	  if (!strcmp (config_table[i].param_name, "IsaUseDensityInstruction"))
+	    {
+	      isa->has_density = atoi (config_table[i].param_value);
+	    }
+	}
+      if (!found_memory_order)
+	{
+	  fprintf (stderr, "Error: \"IsaMemoryOrder\" missing from "
+		   "configuration table in ISA DLL\n");
+	  return 0;
+	}
+
+      return 1;
+    }
+
+  /* For subsequent modules, check that the parameters match.  Note: This
+     code is sufficient to handle the current model where there are never
+     more than 2 modules; we might at some point want to handle cases where
+     module N > 0 specifies some parameters not included in the base table,
+     and we would then add those to isa->config so that subsequent modules
+     would check against them. */
+
+  for (i = 0; config_table[i].param_name; i++)
+    {
+      for (j = 0; isa->config[j].param_name; j++)
+	{
+	  if (!strcmp (config_table[i].param_name, isa->config[j].param_name))
+	    {
+	      int mismatch;
+	      if (!strcmp (config_table[i].param_name, "IsaCoprocessorCount"))
+		{
+		  /* Only require the coprocessor count to be <= the base.  */
+		  int tiecnt = atoi (config_table[i].param_value);
+		  int basecnt = atoi (isa->config[j].param_value);
+		  mismatch = (tiecnt > basecnt);
+		}
+	      else
+		mismatch = strcmp (config_table[i].param_value,
+				   isa->config[j].param_value);
+	      if (mismatch)
+		{
+#define MISMATCH_MESSAGE \
+"Error: Configuration mismatch in the \"%s\" parameter:\n\
+the configuration used when the TIE file was compiled had a value of\n\
+\"%s\", while the current configuration has a value of\n\
+\"%s\". Please rerun the TIE compiler with a matching\n\
+configuration.\n"
+		  fprintf (stderr, MISMATCH_MESSAGE,
+			   config_table[i].param_name,
+			   config_table[i].param_value,
+			   isa->config[j].param_value);
+		  return 0;
+		}
+	      break;
+	    }
+	}
+    }
+
+  return 1;
 }
 
 
-#define CHECK_ALLOC(MEM,ERRVAL) \
-  do { \
-    if ((MEM) == 0) \
-      { \
-	xtisa_errno = xtensa_isa_out_of_memory; \
-	strcpy (xtisa_error_msg, "out of memory"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
+static int
+xtensa_add_isa (xtensa_isa_internal *isa, libisa_module_specifier libisa)
+{
+  int (*get_num_opcodes_fn) (void);
+  struct config_struct *(*get_config_table_fn) (void);
+  xtensa_opcode_internal **(*get_opcodes_fn) (void);
+  int (*decode_insn_fn) (const xtensa_insnbuf);
+  xtensa_opcode_internal **opcodes;
+  int opc, insn_size, prev_num_opcodes, new_num_opcodes, this_module;
 
-#define CHECK_ALLOC_FOR_INIT(MEM,ERRVAL,ERRNO_P,ERROR_MSG_P) \
-  do { \
-    if ((MEM) == 0) \
-      { \
-	xtisa_errno = xtensa_isa_out_of_memory; \
-	strcpy (xtisa_error_msg, "out of memory"); \
-	if (ERRNO_P) *(ERRNO_P) = xtisa_errno; \
-	if (ERROR_MSG_P) *(ERROR_MSG_P) = xtisa_error_msg; \
-	return (ERRVAL); \
-      } \
-  } while (0)
+  get_num_opcodes_fn = xtensa_isa_modules[libisa].get_num_opcodes_fn;
+  get_opcodes_fn = xtensa_isa_modules[libisa].get_opcodes_fn;
+  decode_insn_fn = xtensa_isa_modules[libisa].decode_insn_fn;
+  get_config_table_fn = xtensa_isa_modules[libisa].get_config_table_fn;
 
-
-/* Instruction buffers.  */
+  if (!get_num_opcodes_fn || !get_opcodes_fn || !decode_insn_fn
+      || (!get_config_table_fn && isa->num_modules == 0))
+    return 0;
+
+  if (get_config_table_fn
+      && !xtensa_check_isa_config (isa, get_config_table_fn ()))
+    return 0;
+
+  prev_num_opcodes = isa->num_opcodes;
+  new_num_opcodes = (*get_num_opcodes_fn) ();
+
+  isa->num_opcodes += new_num_opcodes;
+  isa->opcode_table = (xtensa_opcode_internal **)
+    realloc (isa->opcode_table, isa->num_opcodes *
+	     sizeof (xtensa_opcode_internal *));
+  isa->opname_lookup_table = (opname_lookup_entry *)
+    realloc (isa->opname_lookup_table, isa->num_opcodes *
+	     sizeof (opname_lookup_entry));
+
+  opcodes = (*get_opcodes_fn) ();
+
+  insn_size = isa->insn_size;
+  for (opc = 0; opc < new_num_opcodes; opc++)
+    {
+      xtensa_opcode_internal *intopc = opcodes[opc];
+      int newopc = prev_num_opcodes + opc;
+      isa->opcode_table[newopc] = intopc;
+      isa->opname_lookup_table[newopc].key = intopc->name;
+      isa->opname_lookup_table[newopc].opcode = newopc;
+      if (intopc->length > insn_size)
+	insn_size = intopc->length;
+    }
+
+  isa->insn_size = insn_size;
+  isa->insnbuf_size = ((isa->insn_size + sizeof (xtensa_insnbuf_word) - 1) /
+		       sizeof (xtensa_insnbuf_word));
+
+  qsort (isa->opname_lookup_table, isa->num_opcodes,
+	 sizeof (opname_lookup_entry), opname_lookup_compare);
+
+  /* Check for duplicate opcode names.  */
+  for (opc = 1; opc < isa->num_opcodes; opc++)
+    {
+      if (!opname_lookup_compare (&isa->opname_lookup_table[opc-1],
+				  &isa->opname_lookup_table[opc]))
+	{
+	  fprintf (stderr, "Error: Duplicate TIE opcode \"%s\"\n",
+		   isa->opname_lookup_table[opc].key);
+	  return 0;
+	}
+    }
+
+  this_module = isa->num_modules;
+  isa->num_modules += 1;
+
+  isa->module_opcode_base = (int *) realloc (isa->module_opcode_base,
+					     isa->num_modules * sizeof (int));
+  isa->module_decode_fn = (xtensa_insn_decode_fn *)
+    realloc (isa->module_decode_fn, isa->num_modules *
+	     sizeof (xtensa_insn_decode_fn));
+
+  isa->module_opcode_base[this_module] = prev_num_opcodes;
+  isa->module_decode_fn[this_module] = decode_insn_fn;
+
+  xtensa_default_isa = isa;
+
+  return 1;	/* Library was successfully added.  */
+}
+
+
+xtensa_isa
+xtensa_load_isa (libisa_module_specifier libisa)
+{
+  xtensa_isa_internal *isa;
+
+  isa = (xtensa_isa_internal *) malloc (sizeof (xtensa_isa_internal));
+  memset (isa, 0, sizeof (xtensa_isa_internal));
+  if (!xtensa_add_isa (isa, libisa))
+    {
+      xtensa_isa_free (isa);
+      return NULL;
+    }
+  return (xtensa_isa) isa;
+}
+
 
 int
-xtensa_insnbuf_size (xtensa_isa isa)
+xtensa_extend_isa (xtensa_isa isa, libisa_module_specifier libisa)
 {
   xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->insnbuf_size;
-}
-
-
-xtensa_insnbuf
-xtensa_insnbuf_alloc (xtensa_isa isa)
-{
-  xtensa_insnbuf result = (xtensa_insnbuf)
-    malloc (xtensa_insnbuf_size (isa) * sizeof (xtensa_insnbuf_word));
-  CHECK_ALLOC (result, 0);
-  return result;
+  return xtensa_add_isa (intisa, libisa);
 }
 
 
 void
-xtensa_insnbuf_free (xtensa_isa isa __attribute__ ((unused)),
-		     xtensa_insnbuf buf)
+xtensa_isa_free (xtensa_isa isa)
 {
-  free (buf);
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  if (intisa->opcode_table)
+    free (intisa->opcode_table);
+  if (intisa->opname_lookup_table)
+    free (intisa->opname_lookup_table);
+  if (intisa->module_opcode_base)
+    free (intisa->module_opcode_base);
+  if (intisa->module_decode_fn)
+    free (intisa->module_decode_fn);
+  free (intisa);
+}
+
+
+int
+xtensa_insn_maxlength (xtensa_isa isa)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  return intisa->insn_size;
+}
+
+
+int
+xtensa_insnbuf_size (xtensa_isa isa)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *)isa;
+  return intisa->insnbuf_size;
+}
+
+
+int
+xtensa_num_opcodes (xtensa_isa isa)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  return intisa->num_opcodes;
+}
+
+
+xtensa_opcode
+xtensa_opcode_lookup (xtensa_isa isa, const char *opname)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  opname_lookup_entry entry, *result;
+
+  entry.key = opname;
+  result = bsearch (&entry, intisa->opname_lookup_table, intisa->num_opcodes,
+		    sizeof (opname_lookup_entry), opname_lookup_compare);
+  if (!result) return XTENSA_UNDEFINED;
+  return result->opcode;
+}
+
+
+xtensa_opcode
+xtensa_decode_insn (xtensa_isa isa, const xtensa_insnbuf insn)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  int n, opc;
+  for (n = 0; n < intisa->num_modules; n++) {
+    opc = (intisa->module_decode_fn[n]) (insn);
+    if (opc != XTENSA_UNDEFINED)
+      return intisa->module_opcode_base[n] + opc;
+  }
+  return XTENSA_UNDEFINED;
+}
+
+
+/* Opcode information.  */
+
+void
+xtensa_encode_insn (xtensa_isa isa, xtensa_opcode opc, xtensa_insnbuf insn)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  xtensa_insnbuf template = intisa->opcode_table[opc]->template();
+  int len = intisa->opcode_table[opc]->length;
+  int n;
+
+  /* Convert length to 32-bit words.  */
+  len = (len + 3) / 4;
+
+  /* Copy the template.  */
+  for (n = 0; n < len; n++)
+    insn[n] = template[n];
+
+  /* Fill any unused buffer space with zeros.  */
+  for ( ; n < intisa->insnbuf_size; n++)
+    insn[n] = 0;
+}
+
+
+const char *
+xtensa_opcode_name (xtensa_isa isa, xtensa_opcode opc)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  return intisa->opcode_table[opc]->name;
+}
+
+
+int
+xtensa_insn_length (xtensa_isa isa, xtensa_opcode opc)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  return intisa->opcode_table[opc]->length;
+}
+
+
+int
+xtensa_insn_length_from_first_byte (xtensa_isa isa, char first_byte)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  int is_density = (first_byte & (intisa->is_big_endian ? 0x80 : 0x08)) != 0;
+  return (intisa->has_density && is_density ? 2 : 3);
+}
+
+
+int
+xtensa_num_operands (xtensa_isa isa, xtensa_opcode opc)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  return intisa->opcode_table[opc]->iclass->num_operands;
+}
+
+
+xtensa_operand
+xtensa_get_operand (xtensa_isa isa, xtensa_opcode opc, int opnd)
+{
+  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+  xtensa_iclass_internal *iclass = intisa->opcode_table[opc]->iclass;
+  if (opnd >= iclass->num_operands)
+    return NULL;
+  return (xtensa_operand) iclass->operands[opnd];
+}
+
+
+/* Operand information.  */
+
+char *
+xtensa_operand_kind (xtensa_operand opnd)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return intop->operand_kind;
+}
+
+
+char
+xtensa_operand_inout (xtensa_operand opnd)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return intop->inout;
+}
+
+
+uint32
+xtensa_operand_get_field (xtensa_operand opnd, const xtensa_insnbuf insn)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return (*intop->get_field) (insn);
+}
+
+
+void
+xtensa_operand_set_field (xtensa_operand opnd, xtensa_insnbuf insn, uint32 val)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return (*intop->set_field) (insn, val);
+}
+
+
+xtensa_encode_result
+xtensa_operand_encode (xtensa_operand opnd, uint32 *valp)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return (*intop->encode) (valp);
+}
+
+
+uint32
+xtensa_operand_decode (xtensa_operand opnd, uint32 val)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return (*intop->decode) (val);
+}
+
+
+int
+xtensa_operand_isPCRelative (xtensa_operand opnd)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  return intop->isPCRelative;
+}
+
+
+uint32
+xtensa_operand_do_reloc (xtensa_operand opnd, uint32 addr, uint32 pc)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  if (!intop->isPCRelative)
+    return addr;
+  return (*intop->do_reloc) (addr, pc);
+}
+
+
+uint32
+xtensa_operand_undo_reloc (xtensa_operand opnd, uint32 offset, uint32 pc)
+{
+  xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+  if (!intop->isPCRelative)
+    return offset;
+  return (*intop->undo_reloc) (offset, pc);
+}
+
+
+/* Instruction buffers.  */
+
+xtensa_insnbuf
+xtensa_insnbuf_alloc (xtensa_isa isa)
+{
+  return (xtensa_insnbuf) malloc (xtensa_insnbuf_size (isa) *
+				  sizeof (xtensa_insnbuf_word));
+}
+
+
+void
+xtensa_insnbuf_free (xtensa_insnbuf buf)
+{
+  free( buf );
 }
 
 
@@ -110,26 +513,20 @@
 }
 
 
-/* Copy an instruction in the 32-bit words pointed at by "insn" to
-   characters pointed at by "cp".  This is more complicated than you
-   might think because we want 16-bit instructions in bytes 2 & 3 for
-   big-endian configurations.  This function allows us to specify
-   which byte in "insn" to start with and which way to increment,
-   allowing trivial implementation for both big- and little-endian
-   configurations....and it seems to make pretty good code for
-   both.  */
+/* Copy an instruction in the 32 bit words pointed at by <insn> to characters
+   pointed at by <cp>.  This is more complicated than you might think because
+   we want 16 bit instructions in bytes 2,3 for big endian. This function
+   allows us to specify which byte in <insn> to start with and which way to
+   increment, allowing trivial implementation for both big and little endian.
+   And it seems to make pretty good code for both.  */
 
-int
-xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp,
-			 int num_chars)
+void
+xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp)
 {
   xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int insn_size = xtensa_isa_maxlength (isa);
+  int insn_size = xtensa_insn_maxlength (intisa);
   int fence_post, start, increment, i, byte_count;
-  xtensa_format fmt;
-
-  if (num_chars == 0)
-    num_chars = insn_size;
+  xtensa_opcode opc;
 
   if (intisa->is_big_endian)
     {
@@ -142,23 +539,13 @@
       increment = 1;
     }
 
-  /* Find the instruction format.  Do nothing if the buffer does not contain
-     a valid instruction since we need to know how many bytes to copy.  */
-  fmt = xtensa_format_decode (isa, insn);
-  if (fmt == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
+  /* Find the opcode; do nothing if the buffer does not contain a valid
+     instruction since we need to know how many bytes to copy.  */
+  opc = xtensa_decode_insn (isa, insn);
+  if (opc == XTENSA_UNDEFINED)
+    return;
 
-  byte_count = xtensa_format_length (isa, fmt);
-  if (byte_count == XTENSA_UNDEFINED)
-    return XTENSA_UNDEFINED;
-
-  if (byte_count > num_chars)
-    {
-      xtisa_errno = xtensa_isa_buffer_overflow;
-      strcpy (xtisa_error_msg, "output buffer too small for instruction");
-      return XTENSA_UNDEFINED;
-    }
-
+  byte_count = xtensa_insn_length (isa, opc);
   fence_post = start + (byte_count * increment);
 
   for (i = start; i != fence_post; i += increment, ++cp)
@@ -168,39 +555,22 @@
 
       *cp = (insn[word_inx] >> bit_inx) & 0xff;
     }
-
-  return byte_count;
 }
 
-
 /* Inward conversion from byte stream to xtensa_insnbuf.  See
-   xtensa_insnbuf_to_chars for a discussion of why this is complicated
-   by endianness.  */
+   xtensa_insnbuf_to_chars for a discussion of why this is
+   complicated by endianness.  */
     
 void
-xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, const char *cp,
-			   int num_chars)
+xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, const char* cp)
 {
   xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int max_size, insn_size, fence_post, start, increment, i;
-
-  max_size = xtensa_isa_maxlength (isa);
-
-  /* Decode the instruction length so we know how many bytes to read.  */
-  insn_size = (intisa->length_decode_fn) (cp);
-  if (insn_size == XTENSA_UNDEFINED)
-    {
-      /* This should never happen when the byte stream contains a
-	 valid instruction.  Just read the maximum number of bytes....  */
-      insn_size = max_size;
-    }
-
-  if (num_chars == 0 || num_chars > insn_size)
-    num_chars = insn_size;
+  int insn_size = xtensa_insn_maxlength (intisa);
+  int fence_post, start, increment, i;
 
   if (intisa->is_big_endian)
     {
-      start = max_size - 1;
+      start = insn_size - 1;
       increment = -1;
     }
   else
@@ -209,10 +579,10 @@
       increment = 1;
     }
 
-  fence_post = start + (num_chars * increment);
+  fence_post = start + (insn_size * increment);
   memset (insn, 0, xtensa_insnbuf_size (isa) * sizeof (xtensa_insnbuf_word));
 
-  for (i = start; i != fence_post; i += increment, ++cp)
+  for ( i = start; i != fence_post; i += increment, ++cp )
     {
       int word_inx = byte_to_word_index (i);
       int bit_inx = byte_to_bit_index (i);
@@ -221,1521 +591,3 @@
     }
 }
 
-
-
-/* ISA information.  */
-
-extern xtensa_isa_internal xtensa_modules;
-
-xtensa_isa
-xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p)
-{
-  xtensa_isa_internal *isa = &xtensa_modules;
-  int n, is_user;
-
-  /* Set up the opcode name lookup table.  */
-  isa->opname_lookup_table =
-    bfd_malloc (isa->num_opcodes * sizeof (xtensa_lookup_entry));
-  CHECK_ALLOC_FOR_INIT (isa->opname_lookup_table, NULL, errno_p, error_msg_p);
-  for (n = 0; n < isa->num_opcodes; n++)
-    {
-      isa->opname_lookup_table[n].key = isa->opcodes[n].name;
-      isa->opname_lookup_table[n].u.opcode = n;
-    }
-  qsort (isa->opname_lookup_table, isa->num_opcodes,
-	 sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  /* Set up the state name lookup table.  */
-  isa->state_lookup_table =
-    bfd_malloc (isa->num_states * sizeof (xtensa_lookup_entry));
-  CHECK_ALLOC_FOR_INIT (isa->state_lookup_table, NULL, errno_p, error_msg_p);
-  for (n = 0; n < isa->num_states; n++)
-    {
-      isa->state_lookup_table[n].key = isa->states[n].name;
-      isa->state_lookup_table[n].u.state = n;
-    }
-  qsort (isa->state_lookup_table, isa->num_states,
-	 sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  /* Set up the sysreg name lookup table.  */
-  isa->sysreg_lookup_table =
-    bfd_malloc (isa->num_sysregs * sizeof (xtensa_lookup_entry));
-  CHECK_ALLOC_FOR_INIT (isa->sysreg_lookup_table, NULL, errno_p, error_msg_p);
-  for (n = 0; n < isa->num_sysregs; n++)
-    {
-      isa->sysreg_lookup_table[n].key = isa->sysregs[n].name;
-      isa->sysreg_lookup_table[n].u.sysreg = n;
-    }
-  qsort (isa->sysreg_lookup_table, isa->num_sysregs,
-	 sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  /* Set up the user & system sysreg number tables.  */
-  for (is_user = 0; is_user < 2; is_user++)
-    {
-      isa->sysreg_table[is_user] =
-	bfd_malloc ((isa->max_sysreg_num[is_user] + 1)
-		    * sizeof (xtensa_sysreg));
-      CHECK_ALLOC_FOR_INIT (isa->sysreg_table[is_user], NULL,
-			    errno_p, error_msg_p);
-
-      for (n = 0; n <= isa->max_sysreg_num[is_user]; n++)
-	isa->sysreg_table[is_user][n] = XTENSA_UNDEFINED;
-    }
-  for (n = 0; n < isa->num_sysregs; n++)
-    {
-      xtensa_sysreg_internal *sreg = &isa->sysregs[n];
-      is_user = sreg->is_user;
-
-      isa->sysreg_table[is_user][sreg->number] = n;
-    }
-
-  /* Set up the interface lookup table.  */
-  isa->interface_lookup_table = 
-    bfd_malloc (isa->num_interfaces * sizeof (xtensa_lookup_entry));
-  CHECK_ALLOC_FOR_INIT (isa->interface_lookup_table, NULL, errno_p,
-			error_msg_p);
-  for (n = 0; n < isa->num_interfaces; n++)
-    {
-      isa->interface_lookup_table[n].key = isa->interfaces[n].name;
-      isa->interface_lookup_table[n].u.intf = n;
-    }
-  qsort (isa->interface_lookup_table, isa->num_interfaces,
-	 sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  /* Set up the funcUnit lookup table.  */
-  isa->funcUnit_lookup_table = 
-    bfd_malloc (isa->num_funcUnits * sizeof (xtensa_lookup_entry));
-  CHECK_ALLOC_FOR_INIT (isa->funcUnit_lookup_table, NULL, errno_p,
-			error_msg_p);
-  for (n = 0; n < isa->num_funcUnits; n++)
-    {
-      isa->funcUnit_lookup_table[n].key = isa->funcUnits[n].name;
-      isa->funcUnit_lookup_table[n].u.fun = n;
-    }
-  qsort (isa->funcUnit_lookup_table, isa->num_funcUnits,
-	 sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  isa->insnbuf_size = ((isa->insn_size + sizeof (xtensa_insnbuf_word) - 1) /
-		       sizeof (xtensa_insnbuf_word));
-
-  return (xtensa_isa) isa;
-}
-
-
-void
-xtensa_isa_free (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int n;
-
-  /* With this version of the code, the xtensa_isa structure is not
-     dynamically allocated, so this function is not essential.  Free
-     the memory allocated by xtensa_isa_init and restore the xtensa_isa
-     structure to its initial state.  */
-
-  if (intisa->opname_lookup_table)
-    {
-      free (intisa->opname_lookup_table);
-      intisa->opname_lookup_table = 0;
-    }
-
-  if (intisa->state_lookup_table)
-    {
-      free (intisa->state_lookup_table);
-      intisa->state_lookup_table = 0;
-    }
-
-  if (intisa->sysreg_lookup_table)
-    {
-      free (intisa->sysreg_lookup_table);
-      intisa->sysreg_lookup_table = 0;
-    }
-  for (n = 0; n < 2; n++)
-    {
-      if (intisa->sysreg_table[n])
-	{
-	  free (intisa->sysreg_table[n]);
-	  intisa->sysreg_table[n] = 0;
-	}
-    }
-
-  if (intisa->interface_lookup_table)
-    {
-      free (intisa->interface_lookup_table);
-      intisa->interface_lookup_table = 0;
-    }
-
-  if (intisa->funcUnit_lookup_table)
-    {
-      free (intisa->funcUnit_lookup_table);
-      intisa->funcUnit_lookup_table = 0;
-    }
-}
-
-
-int
-xtensa_isa_name_compare (const void *v1, const void *v2)
-{
-  xtensa_lookup_entry *e1 = (xtensa_lookup_entry *) v1;
-  xtensa_lookup_entry *e2 = (xtensa_lookup_entry *) v2;
-
-  return strcasecmp (e1->key, e2->key);
-}
-
-
-int
-xtensa_isa_maxlength (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->insn_size;
-}
-
-
-int
-xtensa_isa_length_from_chars (xtensa_isa isa, const char *cp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return (intisa->length_decode_fn) (cp);
-}
-
-
-int
-xtensa_isa_num_pipe_stages (xtensa_isa isa) 
-{
-  int num_opcodes, num_uses;
-  xtensa_opcode opcode;
-  xtensa_funcUnit_use *use;
-  int i, stage, max_stage = XTENSA_UNDEFINED;
-
-  num_opcodes = xtensa_isa_num_opcodes (isa);
-  for (opcode = 0; opcode < num_opcodes; opcode++)
-    {
-      num_uses = xtensa_opcode_num_funcUnit_uses (isa, opcode);
-      for (i = 0; i < num_uses; i++)
-	{
-	  use = xtensa_opcode_funcUnit_use (isa, opcode, i);
-	  stage = use->stage;
-	  if (stage > max_stage)
-	    max_stage = stage;
-	}
-    }
-
-  return max_stage + 1;
-}
-
-
-int
-xtensa_isa_num_formats (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_formats;
-}
-
-
-int
-xtensa_isa_num_opcodes (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_opcodes;
-}
-
-
-int
-xtensa_isa_num_regfiles (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_regfiles;
-}
-
-
-int
-xtensa_isa_num_states (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_states;
-}
-
-
-int
-xtensa_isa_num_sysregs (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_sysregs;
-}
-
-
-int
-xtensa_isa_num_interfaces (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_interfaces;
-}
-
-
-int
-xtensa_isa_num_funcUnits (xtensa_isa isa)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  return intisa->num_funcUnits;
-}
-
-
-
-/* Instruction formats.  */
-
-
-#define CHECK_FORMAT(INTISA,FMT,ERRVAL) \
-  do { \
-    if ((FMT) < 0 || (FMT) >= (INTISA)->num_formats) \
-      { \
-	xtisa_errno = xtensa_isa_bad_format; \
-	strcpy (xtisa_error_msg, "invalid format specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-#define CHECK_SLOT(INTISA,FMT,SLOT,ERRVAL) \
-  do { \
-    if ((SLOT) < 0 || (SLOT) >= (INTISA)->formats[FMT].num_slots) \
-      { \
-	xtisa_errno = xtensa_isa_bad_slot; \
-	strcpy (xtisa_error_msg, "invalid slot specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-const char *
-xtensa_format_name (xtensa_isa isa, xtensa_format fmt)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FORMAT (intisa, fmt, NULL);
-  return intisa->formats[fmt].name;
-}
-
-
-xtensa_format
-xtensa_format_lookup (xtensa_isa isa, const char *fmtname)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int fmt;
-
-  if (!fmtname || !*fmtname)
-    {
-      xtisa_errno = xtensa_isa_bad_format;
-      strcpy (xtisa_error_msg, "invalid format name");
-      return XTENSA_UNDEFINED;
-    }
-
-  for (fmt = 0; fmt < intisa->num_formats; fmt++)
-    {
-      if (strcasecmp (fmtname, intisa->formats[fmt].name) == 0)
-	return fmt;
-    }
-  
-  xtisa_errno = xtensa_isa_bad_format;
-  sprintf (xtisa_error_msg, "format \"%s\" not recognized", fmtname);
-  return XTENSA_UNDEFINED;
-}
-
-
-xtensa_format
-xtensa_format_decode (xtensa_isa isa, const xtensa_insnbuf insn)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_format fmt;
-
-  fmt = (intisa->format_decode_fn) (insn);
-  if (fmt != XTENSA_UNDEFINED)
-    return fmt;
-
-  xtisa_errno = xtensa_isa_bad_format;
-  strcpy (xtisa_error_msg, "cannot decode instruction format");
-  return XTENSA_UNDEFINED;
-}
-
-
-int
-xtensa_format_encode (xtensa_isa isa, xtensa_format fmt, xtensa_insnbuf insn)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FORMAT (intisa, fmt, -1);
-  (*intisa->formats[fmt].encode_fn) (insn);
-  return 0;
-}
-
-
-int
-xtensa_format_length (xtensa_isa isa, xtensa_format fmt)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FORMAT (intisa, fmt, XTENSA_UNDEFINED);
-  return intisa->formats[fmt].length;
-}
-
-
-int
-xtensa_format_num_slots (xtensa_isa isa, xtensa_format fmt)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FORMAT (intisa, fmt, XTENSA_UNDEFINED);
-  return intisa->formats[fmt].num_slots;
-}
-
-
-xtensa_opcode
-xtensa_format_slot_nop_opcode (xtensa_isa isa, xtensa_format fmt, int slot)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int slot_id;
-
-  CHECK_FORMAT (intisa, fmt, XTENSA_UNDEFINED);
-  CHECK_SLOT (intisa, fmt, slot, XTENSA_UNDEFINED);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  return xtensa_opcode_lookup (isa, intisa->slots[slot_id].nop_name);
-}
-
-
-int
-xtensa_format_get_slot (xtensa_isa isa, xtensa_format fmt, int slot,
-			const xtensa_insnbuf insn, xtensa_insnbuf slotbuf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int slot_id;
-
-  CHECK_FORMAT (intisa, fmt, -1);
-  CHECK_SLOT (intisa, fmt, slot, -1);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  (*intisa->slots[slot_id].get_fn) (insn, slotbuf);
-  return 0;
-}
-
-
-int
-xtensa_format_set_slot (xtensa_isa isa, xtensa_format fmt, int slot,
-			xtensa_insnbuf insn, const xtensa_insnbuf slotbuf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int slot_id;
-
-  CHECK_FORMAT (intisa, fmt, -1);
-  CHECK_SLOT (intisa, fmt, slot, -1);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  (*intisa->slots[slot_id].set_fn) (insn, slotbuf);
-  return 0;
-}
-
-
-
-/* Opcode information.  */
-
-
-#define CHECK_OPCODE(INTISA,OPC,ERRVAL) \
-  do { \
-    if ((OPC) < 0 || (OPC) >= (INTISA)->num_opcodes) \
-      { \
-	xtisa_errno = xtensa_isa_bad_opcode; \
-	strcpy (xtisa_error_msg, "invalid opcode specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_opcode
-xtensa_opcode_lookup (xtensa_isa isa, const char *opname)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_lookup_entry entry, *result;
-
-  if (!opname || !*opname)
-    {
-      xtisa_errno = xtensa_isa_bad_opcode;
-      strcpy (xtisa_error_msg, "invalid opcode name");
-      return XTENSA_UNDEFINED;
-    }
-
-  entry.key = opname;
-  result = bsearch (&entry, intisa->opname_lookup_table, intisa->num_opcodes,
-		    sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  if (!result)
-    {
-      xtisa_errno = xtensa_isa_bad_opcode;
-      sprintf (xtisa_error_msg, "opcode \"%s\" not recognized", opname);
-      return XTENSA_UNDEFINED;
-    }
-
-  return result->u.opcode;
-}
-
-
-xtensa_opcode
-xtensa_opcode_decode (xtensa_isa isa, xtensa_format fmt, int slot,
-		      const xtensa_insnbuf slotbuf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int slot_id;
-  xtensa_opcode opc;
-
-  CHECK_FORMAT (intisa, fmt, XTENSA_UNDEFINED);
-  CHECK_SLOT (intisa, fmt, slot, XTENSA_UNDEFINED);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-
-  opc = (intisa->slots[slot_id].opcode_decode_fn) (slotbuf);
-  if (opc == XTENSA_UNDEFINED)
-    {
-      xtisa_errno = xtensa_isa_bad_opcode;
-      strcpy (xtisa_error_msg, "cannot decode opcode");
-    }
-  return opc;
-}
-
-
-int
-xtensa_opcode_encode (xtensa_isa isa, xtensa_format fmt, int slot,
-		      xtensa_insnbuf slotbuf, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int slot_id;
-  xtensa_opcode_encode_fn encode_fn;
-
-  CHECK_FORMAT (intisa, fmt, -1);
-  CHECK_SLOT (intisa, fmt, slot, -1);
-  CHECK_OPCODE (intisa, opc, -1);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  encode_fn = intisa->opcodes[opc].encode_fns[slot_id];
-  if (!encode_fn)
-    {
-      xtisa_errno = xtensa_isa_wrong_slot;
-      sprintf (xtisa_error_msg,
-	       "opcode \"%s\" is not allowed in slot %d of format \"%s\"",
-	       intisa->opcodes[opc].name, slot, intisa->formats[fmt].name);
-      return -1;
-    }
-  (*encode_fn) (slotbuf);
-  return 0;
-}
-
-
-const char *
-xtensa_opcode_name (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, NULL);
-  return intisa->opcodes[opc].name;
-}
-
-
-int
-xtensa_opcode_is_branch (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  if ((intisa->opcodes[opc].flags & XTENSA_OPCODE_IS_BRANCH) != 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_opcode_is_jump (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  if ((intisa->opcodes[opc].flags & XTENSA_OPCODE_IS_JUMP) != 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_opcode_is_loop (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  if ((intisa->opcodes[opc].flags & XTENSA_OPCODE_IS_LOOP) != 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_opcode_is_call (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  if ((intisa->opcodes[opc].flags & XTENSA_OPCODE_IS_CALL) != 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_opcode_num_operands (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  return intisa->iclasses[iclass_id].num_operands;
-}
-
-
-int
-xtensa_opcode_num_stateOperands (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  return intisa->iclasses[iclass_id].num_stateOperands;
-}
-
-
-int
-xtensa_opcode_num_interfaceOperands (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  return intisa->iclasses[iclass_id].num_interfaceOperands;
-}
-
-
-int
-xtensa_opcode_num_funcUnit_uses (xtensa_isa isa, xtensa_opcode opc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  return intisa->opcodes[opc].num_funcUnit_uses;
-}
-
-
-xtensa_funcUnit_use *
-xtensa_opcode_funcUnit_use (xtensa_isa isa, xtensa_opcode opc, int u)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_OPCODE (intisa, opc, NULL);
-  if (u < 0 || u >= intisa->opcodes[opc].num_funcUnit_uses)
-    {
-      xtisa_errno = xtensa_isa_bad_funcUnit;
-      sprintf (xtisa_error_msg, "invalid functional unit use number (%d); "
-	       "opcode \"%s\" has %d", u, intisa->opcodes[opc].name,
-	       intisa->opcodes[opc].num_funcUnit_uses);
-      return NULL;
-    }
-  return &intisa->opcodes[opc].funcUnit_uses[u];
-}
-
-
-
-/* Operand information.  */
-
-
-#define CHECK_OPERAND(INTISA,OPC,ICLASS,OPND,ERRVAL) \
-  do { \
-    if ((OPND) < 0 || (OPND) >= (ICLASS)->num_operands) \
-      { \
-	xtisa_errno = xtensa_isa_bad_operand; \
-	sprintf (xtisa_error_msg, "invalid operand number (%d); " \
-		 "opcode \"%s\" has %d operands", (OPND), \
-		 (INTISA)->opcodes[(OPC)].name, (ICLASS)->num_operands); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-static xtensa_operand_internal *
-get_operand (xtensa_isa_internal *intisa, xtensa_opcode opc, int opnd)
-{
-  xtensa_iclass_internal *iclass;
-  int iclass_id, operand_id;
-
-  CHECK_OPCODE (intisa, opc, NULL);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_OPERAND (intisa, opc, iclass, opnd, NULL);
-  operand_id = iclass->operands[opnd].u.operand_id;
-  return &intisa->operands[operand_id];
-}
-
-
-const char *
-xtensa_operand_name (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return NULL;
-  return intop->name;
-}
-
-
-int
-xtensa_operand_is_visible (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_iclass_internal *iclass;
-  int iclass_id, operand_id;
-  xtensa_operand_internal *intop;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_OPERAND (intisa, opc, iclass, opnd, XTENSA_UNDEFINED);
-
-  /* Special case for "sout" operands.  */
-  if (iclass->operands[opnd].inout == 's')
-    return 0;
-
-  operand_id = iclass->operands[opnd].u.operand_id;
-  intop = &intisa->operands[operand_id];
-
-  if ((intop->flags & XTENSA_OPERAND_IS_INVISIBLE) == 0)
-    return 1;
-  return 0;
-}
-
-
-char
-xtensa_operand_inout (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_iclass_internal *iclass;
-  int iclass_id;
-  char inout;
-
-  CHECK_OPCODE (intisa, opc, 0);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_OPERAND (intisa, opc, iclass, opnd, 0);
-  inout = iclass->operands[opnd].inout;
-
-  /* Special case for "sout" operands.  */
-  if (inout == 's')
-    return 'o';
-
-  return inout;
-}
-
-
-int
-xtensa_operand_get_field (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			  xtensa_format fmt, int slot,
-			  const xtensa_insnbuf slotbuf, uint32 *valp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-  int slot_id;
-  xtensa_get_field_fn get_fn;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  CHECK_FORMAT (intisa, fmt, -1);
-  CHECK_SLOT (intisa, fmt, slot, -1);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  if (intop->field_id == XTENSA_UNDEFINED)
-    {
-      xtisa_errno = xtensa_isa_no_field;
-      strcpy (xtisa_error_msg, "implicit operand has no field");
-      return -1;
-    }
-  get_fn = intisa->slots[slot_id].get_field_fns[intop->field_id];
-  if (!get_fn)
-    {
-      xtisa_errno = xtensa_isa_wrong_slot;
-      sprintf (xtisa_error_msg,
-	       "operand \"%s\" does not exist in slot %d of format \"%s\"",
-	       intop->name, slot, intisa->formats[fmt].name);
-      return -1;
-    }
-  *valp = (*get_fn) (slotbuf);
-  return 0;
-}
-
-
-int
-xtensa_operand_set_field (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			  xtensa_format fmt, int slot,
-			  xtensa_insnbuf slotbuf, uint32 val)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-  int slot_id;
-  xtensa_set_field_fn set_fn;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  CHECK_FORMAT (intisa, fmt, -1);
-  CHECK_SLOT (intisa, fmt, slot, -1);
-
-  slot_id = intisa->formats[fmt].slot_id[slot];
-  if (intop->field_id == XTENSA_UNDEFINED)
-    {
-      xtisa_errno = xtensa_isa_no_field;
-      strcpy (xtisa_error_msg, "implicit operand has no field");
-      return -1;
-    }
-  set_fn = intisa->slots[slot_id].set_field_fns[intop->field_id];
-  if (!set_fn)
-    {
-      xtisa_errno = xtensa_isa_wrong_slot;
-      sprintf (xtisa_error_msg,
-	       "operand \"%s\" does not exist in slot %d of format \"%s\"",
-	       intop->name, slot, intisa->formats[fmt].name);
-      return -1;
-    }
-  (*set_fn) (slotbuf, val);
-  return 0;
-}
-
-
-int
-xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
-		       uint32 *valp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-  uint32 test_val, orig_val;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  if (!intop->encode)
-    {
-      /* This is a default operand for a field.  How can we tell if the
-	 value fits in the field?  Write the value into the field,
-	 read it back, and then make sure we get the same value.  */
-
-      xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-      static xtensa_insnbuf tmpbuf = 0;
-      int slot_id;
-
-      if (!tmpbuf)
-	{
-	  tmpbuf = xtensa_insnbuf_alloc (isa);
-	  CHECK_ALLOC (tmpbuf, -1);
-	}
-
-      /* A default operand is always associated with a field,
-	 but check just to be sure....  */
-      if (intop->field_id == XTENSA_UNDEFINED)
-	{
-	  xtisa_errno = xtensa_isa_internal_error;
-	  strcpy (xtisa_error_msg, "operand has no field");
-	  return -1;
-	}
-
-      /* Find some slot that includes the field.  */
-      for (slot_id = 0; slot_id < intisa->num_slots; slot_id++)
-	{
-	  xtensa_get_field_fn get_fn =
-	    intisa->slots[slot_id].get_field_fns[intop->field_id];
-	  xtensa_set_field_fn set_fn =
-	    intisa->slots[slot_id].set_field_fns[intop->field_id];
-
-	  if (get_fn && set_fn)
-	    {
-	      (*set_fn) (tmpbuf, *valp);
-	      return ((*get_fn) (tmpbuf) != *valp);
-	    }
-	}
-
-      /* Couldn't find any slot containing the field....  */
-      xtisa_errno = xtensa_isa_no_field;
-      strcpy (xtisa_error_msg, "field does not exist in any slot");
-      return -1;
-    }
-
-  /* Encode the value.  In some cases, the encoding function may detect
-     errors, but most of the time the only way to determine if the value
-     was successfully encoded is to decode it and check if it matches
-     the original value.  */
-  orig_val = *valp;
-  if ((*intop->encode) (valp) ||
-      (test_val = *valp, (*intop->decode) (&test_val)) ||
-      test_val != orig_val)
-    {
-      xtisa_errno = xtensa_isa_bad_value;
-      sprintf (xtisa_error_msg, "cannot encode operand value 0x%08x", *valp);
-      return -1;
-    }
-
-  return 0;
-}
-
-
-int
-xtensa_operand_decode (xtensa_isa isa, xtensa_opcode opc, int opnd,
-		       uint32 *valp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  /* Use identity function for "default" operands.  */
-  if (!intop->decode)
-    return 0;
-
-  if ((*intop->decode) (valp))
-    {
-      xtisa_errno = xtensa_isa_bad_value;
-      sprintf (xtisa_error_msg, "cannot decode operand value 0x%08x", *valp);
-      return -1;
-    }
-  return 0;
-}
-
-
-int
-xtensa_operand_is_register (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return XTENSA_UNDEFINED;
-
-  if ((intop->flags & XTENSA_OPERAND_IS_REGISTER) != 0)
-    return 1;
-  return 0;
-}
-
-
-xtensa_regfile
-xtensa_operand_regfile (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return XTENSA_UNDEFINED;
-
-  return intop->regfile;
-}
-
-
-int
-xtensa_operand_num_regs (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return XTENSA_UNDEFINED;
-
-  return intop->num_regs;
-}
-
-
-int
-xtensa_operand_is_known_reg (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return XTENSA_UNDEFINED;
-
-  if ((intop->flags & XTENSA_OPERAND_IS_UNKNOWN) == 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_operand_is_PCrelative (xtensa_isa isa, xtensa_opcode opc, int opnd)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return XTENSA_UNDEFINED;
-
-  if ((intop->flags & XTENSA_OPERAND_IS_PCRELATIVE) != 0)
-    return 1;
-  return 0;
-}
-
-
-int
-xtensa_operand_do_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			 uint32 *valp, uint32 pc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  if ((intop->flags & XTENSA_OPERAND_IS_PCRELATIVE) == 0)
-    return 0;
-
-  if (!intop->do_reloc)
-    {
-      xtisa_errno = xtensa_isa_internal_error;
-      strcpy (xtisa_error_msg, "operand missing do_reloc function");
-      return -1;
-    }
-
-  if ((*intop->do_reloc) (valp, pc))
-    {
-      xtisa_errno = xtensa_isa_bad_value;
-      sprintf (xtisa_error_msg,
-	       "do_reloc failed for value 0x%08x at PC 0x%08x", *valp, pc);
-      return -1;
-    }
-
-  return 0;
-}
-
-
-int
-xtensa_operand_undo_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			   uint32 *valp, uint32 pc)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_operand_internal *intop;
-
-  intop = get_operand (intisa, opc, opnd);
-  if (!intop) return -1;
-
-  if ((intop->flags & XTENSA_OPERAND_IS_PCRELATIVE) == 0)
-    return 0;
-
-  if (!intop->undo_reloc)
-    {
-      xtisa_errno = xtensa_isa_internal_error;
-      strcpy (xtisa_error_msg, "operand missing undo_reloc function");
-      return -1;
-    }
-
-  if ((*intop->undo_reloc) (valp, pc))
-    {
-      xtisa_errno = xtensa_isa_bad_value;
-      sprintf (xtisa_error_msg,
-	       "undo_reloc failed for value 0x%08x at PC 0x%08x", *valp, pc);
-      return -1;
-    }
-
-  return 0;
-}
-
-
-
-/* State Operands.  */
-
-
-#define CHECK_STATE_OPERAND(INTISA,OPC,ICLASS,STOP,ERRVAL) \
-  do { \
-    if ((STOP) < 0 || (STOP) >= (ICLASS)->num_stateOperands) \
-      { \
-	xtisa_errno = xtensa_isa_bad_operand; \
-	sprintf (xtisa_error_msg, "invalid state operand number (%d); " \
-		 "opcode \"%s\" has %d state operands", (STOP), \
-		 (INTISA)->opcodes[(OPC)].name, (ICLASS)->num_stateOperands); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_state
-xtensa_stateOperand_state (xtensa_isa isa, xtensa_opcode opc, int stOp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_iclass_internal *iclass;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_STATE_OPERAND (intisa, opc, iclass, stOp, XTENSA_UNDEFINED);
-  return iclass->stateOperands[stOp].u.state;
-}
-
-
-char
-xtensa_stateOperand_inout (xtensa_isa isa, xtensa_opcode opc, int stOp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_iclass_internal *iclass;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, 0);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_STATE_OPERAND (intisa, opc, iclass, stOp, 0);
-  return iclass->stateOperands[stOp].inout;
-}
-
-
-/* Interface Operands.  */
-
-
-#define CHECK_INTERFACE_OPERAND(INTISA,OPC,ICLASS,IFOP,ERRVAL) \
-  do { \
-    if ((IFOP) < 0 || (IFOP) >= (ICLASS)->num_interfaceOperands) \
-      { \
-	xtisa_errno = xtensa_isa_bad_operand; \
-	sprintf (xtisa_error_msg, "invalid interface operand number (%d); " \
-		 "opcode \"%s\" has %d interface operands", (IFOP), \
-		 (INTISA)->opcodes[(OPC)].name, \
-		 (ICLASS)->num_interfaceOperands); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_interface
-xtensa_interfaceOperand_interface (xtensa_isa isa, xtensa_opcode opc,
-				   int ifOp)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_iclass_internal *iclass;
-  int iclass_id;
-
-  CHECK_OPCODE (intisa, opc, XTENSA_UNDEFINED);
-  iclass_id = intisa->opcodes[opc].iclass_id;
-  iclass = &intisa->iclasses[iclass_id];
-  CHECK_INTERFACE_OPERAND (intisa, opc, iclass, ifOp, XTENSA_UNDEFINED);
-  return iclass->interfaceOperands[ifOp];
-}
-
-
-
-/* Register Files.  */
-
-
-#define CHECK_REGFILE(INTISA,RF,ERRVAL) \
-  do { \
-    if ((RF) < 0 || (RF) >= (INTISA)->num_regfiles) \
-      { \
-	xtisa_errno = xtensa_isa_bad_regfile; \
-	strcpy (xtisa_error_msg, "invalid regfile specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_regfile
-xtensa_regfile_lookup (xtensa_isa isa, const char *name)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int n;
-
-  if (!name || !*name)
-    {
-      xtisa_errno = xtensa_isa_bad_regfile;
-      strcpy (xtisa_error_msg, "invalid regfile name");
-      return XTENSA_UNDEFINED;
-    }
-
-  /* The expected number of regfiles is small; use a linear search.  */
-  for (n = 0; n < intisa->num_regfiles; n++)
-    {
-      if (!strcmp (intisa->regfiles[n].name, name))
-	return n;
-    }
-
-  xtisa_errno = xtensa_isa_bad_regfile;
-  sprintf (xtisa_error_msg, "regfile \"%s\" not recognized", name);
-  return XTENSA_UNDEFINED;
-}
-
-
-xtensa_regfile
-xtensa_regfile_lookup_shortname (xtensa_isa isa, const char *shortname)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  int n;
-
-  if (!shortname || !*shortname)
-    {
-      xtisa_errno = xtensa_isa_bad_regfile;
-      strcpy (xtisa_error_msg, "invalid regfile shortname");
-      return XTENSA_UNDEFINED;
-    }
-
-  /* The expected number of regfiles is small; use a linear search.  */
-  for (n = 0; n < intisa->num_regfiles; n++)
-    {
-      /* Ignore regfile views since they always have the same shortnames
-	 as their parents.  */
-      if (intisa->regfiles[n].parent != n)
-	continue;
-      if (!strcmp (intisa->regfiles[n].shortname, shortname))
-	return n;
-    }
-
-  xtisa_errno = xtensa_isa_bad_regfile;
-  sprintf (xtisa_error_msg, "regfile shortname \"%s\" not recognized",
-	   shortname);
-  return XTENSA_UNDEFINED;
-}
-
-
-const char *
-xtensa_regfile_name (xtensa_isa isa, xtensa_regfile rf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_REGFILE (intisa, rf, NULL);
-  return intisa->regfiles[rf].name;
-}
-
-
-const char *
-xtensa_regfile_shortname (xtensa_isa isa, xtensa_regfile rf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_REGFILE (intisa, rf, NULL);
-  return intisa->regfiles[rf].shortname;
-}
-
-
-xtensa_regfile
-xtensa_regfile_view_parent (xtensa_isa isa, xtensa_regfile rf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_REGFILE (intisa, rf, XTENSA_UNDEFINED);
-  return intisa->regfiles[rf].parent;
-}
-
-
-int
-xtensa_regfile_num_bits (xtensa_isa isa, xtensa_regfile rf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_REGFILE (intisa, rf, XTENSA_UNDEFINED);
-  return intisa->regfiles[rf].num_bits;
-}
-
-
-int
-xtensa_regfile_num_entries (xtensa_isa isa, xtensa_regfile rf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_REGFILE (intisa, rf, XTENSA_UNDEFINED);
-  return intisa->regfiles[rf].num_entries;
-}
-
-
-/* Processor States.  */
-
-
-#define CHECK_STATE(INTISA,ST,ERRVAL) \
-  do { \
-    if ((ST) < 0 || (ST) >= (INTISA)->num_states) \
-      { \
-	xtisa_errno = xtensa_isa_bad_state; \
-	strcpy (xtisa_error_msg, "invalid state specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_state
-xtensa_state_lookup (xtensa_isa isa, const char *name)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_lookup_entry entry, *result;
-
-  if (!name || !*name)
-    {
-      xtisa_errno = xtensa_isa_bad_state;
-      strcpy (xtisa_error_msg, "invalid state name");
-      return XTENSA_UNDEFINED;
-    }
-
-  entry.key = name;
-  result = bsearch (&entry, intisa->state_lookup_table, intisa->num_states,
-		    sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  if (!result)
-    {
-      xtisa_errno = xtensa_isa_bad_state;
-      sprintf (xtisa_error_msg, "state \"%s\" not recognized", name);
-      return XTENSA_UNDEFINED;
-    }
-
-  return result->u.state;
-}
-
-
-const char *
-xtensa_state_name (xtensa_isa isa, xtensa_state st)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_STATE (intisa, st, NULL);
-  return intisa->states[st].name;
-}
-
-
-int
-xtensa_state_num_bits (xtensa_isa isa, xtensa_state st)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_STATE (intisa, st, XTENSA_UNDEFINED);
-  return intisa->states[st].num_bits;
-}
-
-
-int
-xtensa_state_is_exported (xtensa_isa isa, xtensa_state st)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_STATE (intisa, st, XTENSA_UNDEFINED);
-  if ((intisa->states[st].flags & XTENSA_STATE_IS_EXPORTED) != 0)
-    return 1;
-  return 0;
-}
-
-
-/* Sysregs.  */
-
-
-#define CHECK_SYSREG(INTISA,SYSREG,ERRVAL) \
-  do { \
-    if ((SYSREG) < 0 || (SYSREG) >= (INTISA)->num_sysregs) \
-      { \
-	xtisa_errno = xtensa_isa_bad_sysreg; \
-	strcpy (xtisa_error_msg, "invalid sysreg specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_sysreg
-xtensa_sysreg_lookup (xtensa_isa isa, int num, int is_user)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-
-  if (is_user != 0)
-    is_user = 1;
-
-  if (num < 0 || num > intisa->max_sysreg_num[is_user]
-      || intisa->sysreg_table[is_user][num] == XTENSA_UNDEFINED)
-    {
-      xtisa_errno = xtensa_isa_bad_sysreg;
-      strcpy (xtisa_error_msg, "sysreg not recognized");
-      return XTENSA_UNDEFINED;
-    }
-
-  return intisa->sysreg_table[is_user][num];
-}
-
-
-xtensa_sysreg
-xtensa_sysreg_lookup_name (xtensa_isa isa, const char *name)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_lookup_entry entry, *result;
-
-  if (!name || !*name)
-    {
-      xtisa_errno = xtensa_isa_bad_sysreg;
-      strcpy (xtisa_error_msg, "invalid sysreg name");
-      return XTENSA_UNDEFINED;
-    }
-
-  entry.key = name;
-  result = bsearch (&entry, intisa->sysreg_lookup_table, intisa->num_sysregs,
-		    sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  if (!result)
-    {
-      xtisa_errno = xtensa_isa_bad_sysreg;
-      sprintf (xtisa_error_msg, "sysreg \"%s\" not recognized", name);
-      return XTENSA_UNDEFINED;
-    }
-
-  return result->u.sysreg;
-}
-
-
-const char *
-xtensa_sysreg_name (xtensa_isa isa, xtensa_sysreg sysreg)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_SYSREG (intisa, sysreg, NULL);
-  return intisa->sysregs[sysreg].name;
-}
-
-
-int
-xtensa_sysreg_number (xtensa_isa isa, xtensa_sysreg sysreg)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_SYSREG (intisa, sysreg, XTENSA_UNDEFINED);
-  return intisa->sysregs[sysreg].number;
-}
-
-
-int
-xtensa_sysreg_is_user (xtensa_isa isa, xtensa_sysreg sysreg)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_SYSREG (intisa, sysreg, XTENSA_UNDEFINED);
-  if (intisa->sysregs[sysreg].is_user)
-    return 1;
-  return 0;
-}
-
-
-/* Interfaces.  */
-
-
-#define CHECK_INTERFACE(INTISA,INTF,ERRVAL) \
-  do { \
-    if ((INTF) < 0 || (INTF) >= (INTISA)->num_interfaces) \
-      { \
-	xtisa_errno = xtensa_isa_bad_interface; \
-	strcpy (xtisa_error_msg, "invalid interface specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_interface
-xtensa_interface_lookup (xtensa_isa isa, const char *ifname)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_lookup_entry entry, *result;
-
-  if (!ifname || !*ifname)
-    {
-      xtisa_errno = xtensa_isa_bad_interface;
-      strcpy (xtisa_error_msg, "invalid interface name");
-      return XTENSA_UNDEFINED;
-    }
-
-  entry.key = ifname;
-  result = bsearch (&entry, intisa->interface_lookup_table,
-		    intisa->num_interfaces,
-		    sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  if (!result)
-    {
-      xtisa_errno = xtensa_isa_bad_interface;
-      sprintf (xtisa_error_msg, "interface \"%s\" not recognized", ifname);
-      return XTENSA_UNDEFINED;
-    }
-
-  return result->u.intf;
-}
-
-
-const char *
-xtensa_interface_name (xtensa_isa isa, xtensa_interface intf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_INTERFACE (intisa, intf, NULL);
-  return intisa->interfaces[intf].name;
-}
-
-
-int
-xtensa_interface_num_bits (xtensa_isa isa, xtensa_interface intf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_INTERFACE (intisa, intf, XTENSA_UNDEFINED);
-  return intisa->interfaces[intf].num_bits;
-}
-
-
-char
-xtensa_interface_inout (xtensa_isa isa, xtensa_interface intf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_INTERFACE (intisa, intf, 0);
-  return intisa->interfaces[intf].inout;
-}
-
-
-int
-xtensa_interface_has_side_effect (xtensa_isa isa, xtensa_interface intf)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_INTERFACE (intisa, intf, XTENSA_UNDEFINED);
-  if ((intisa->interfaces[intf].flags & XTENSA_INTERFACE_HAS_SIDE_EFFECT) != 0)
-    return 1;
-  return 0;
-}
-
-
-/* Functional Units.  */
-
-
-#define CHECK_FUNCUNIT(INTISA,FUN,ERRVAL) \
-  do { \
-    if ((FUN) < 0 || (FUN) >= (INTISA)->num_funcUnits) \
-      { \
-	xtisa_errno = xtensa_isa_bad_funcUnit; \
-	strcpy (xtisa_error_msg, "invalid functional unit specifier"); \
-	return (ERRVAL); \
-      } \
-  } while (0)
-
-
-xtensa_funcUnit
-xtensa_funcUnit_lookup (xtensa_isa isa, const char *fname)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  xtensa_lookup_entry entry, *result;
-
-  if (!fname || !*fname)
-    {
-      xtisa_errno = xtensa_isa_bad_funcUnit;
-      strcpy (xtisa_error_msg, "invalid functional unit name");
-      return XTENSA_UNDEFINED;
-    }
-
-  entry.key = fname;
-  result = bsearch (&entry, intisa->funcUnit_lookup_table,
-		    intisa->num_funcUnits,
-		    sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
-
-  if (!result)
-    {
-      xtisa_errno = xtensa_isa_bad_funcUnit;
-      sprintf (xtisa_error_msg,
-	       "functional unit \"%s\" not recognized", fname);
-      return XTENSA_UNDEFINED;
-    }
-
-  return result->u.fun;
-}
-
-
-const char *
-xtensa_funcUnit_name (xtensa_isa isa, xtensa_funcUnit fun)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FUNCUNIT (intisa, fun, NULL);
-  return intisa->funcUnits[fun].name;
-}
-
-
-int
-xtensa_funcUnit_num_copies (xtensa_isa isa, xtensa_funcUnit fun)
-{
-  xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
-  CHECK_FUNCUNIT (intisa, fun, XTENSA_UNDEFINED);
-  return intisa->funcUnits[fun].num_copies;
-}
-
diff --git a/bfd/xtensa-modules.c b/bfd/xtensa-modules.c
index bc0cf73..e5d7682 100644
--- a/bfd/xtensa-modules.c
+++ b/bfd/xtensa-modules.c
@@ -1,9101 +1,6088 @@
 /* Xtensa configuration-specific ISA information.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#include "ansidecl.h"
 #include <xtensa-isa.h>
 #include "xtensa-isa-internal.h"
+#include "ansidecl.h"
 
-
-/* Sysregs.  */
+#define BPW 32
+#define WINDEX(_n) ((_n) / BPW)
+#define BINDEX(_n) ((_n) %% BPW)
 
-static xtensa_sysreg_internal sysregs[] = {
-  { "LBEG", 0, 0 },
-  { "LEND", 1, 0 },
-  { "LCOUNT", 2, 0 },
-  { "DDR", 104, 0 },
-  { "176", 176, 0 },
-  { "208", 208, 0 },
-  { "INTERRUPT", 226, 0 },
-  { "INTCLEAR", 227, 0 },
-  { "CCOUNT", 234, 0 },
-  { "PRID", 235, 0 },
-  { "ICOUNT", 236, 0 },
-  { "CCOMPARE0", 240, 0 },
-  { "CCOMPARE1", 241, 0 },
-  { "CCOMPARE2", 242, 0 },
-  { "EPC1", 177, 0 },
-  { "EPC2", 178, 0 },
-  { "EPC3", 179, 0 },
-  { "EPC4", 180, 0 },
-  { "EXCSAVE1", 209, 0 },
-  { "EXCSAVE2", 210, 0 },
-  { "EXCSAVE3", 211, 0 },
-  { "EXCSAVE4", 212, 0 },
-  { "EPS2", 194, 0 },
-  { "EPS3", 195, 0 },
-  { "EPS4", 196, 0 },
-  { "EXCCAUSE", 232, 0 },
-  { "DEPC", 192, 0 },
-  { "EXCVADDR", 238, 0 },
-  { "WINDOWBASE", 72, 0 },
-  { "WINDOWSTART", 73, 0 },
-  { "SAR", 3, 0 },
-  { "LITBASE", 5, 0 },
-  { "PS", 230, 0 },
-  { "MISC0", 244, 0 },
-  { "MISC1", 245, 0 },
-  { "INTENABLE", 228, 0 },
-  { "DBREAKA0", 144, 0 },
-  { "DBREAKC0", 160, 0 },
-  { "DBREAKA1", 145, 0 },
-  { "DBREAKC1", 161, 0 },
-  { "IBREAKA0", 128, 0 },
-  { "IBREAKA1", 129, 0 },
-  { "IBREAKENABLE", 96, 0 },
-  { "ICOUNTLEVEL", 237, 0 },
-  { "DEBUGCAUSE", 233, 0 }
-};
+static uint32 tie_do_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED;
+static uint32 tie_undo_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED;
 
-#define NUM_SYSREGS 45
-#define MAX_SPECIAL_REG 245
-#define MAX_USER_REG 0
-
-
-/* Processor states.  */
-
-static xtensa_state_internal states[] = {
-  { "LCOUNT", 32, 0 },
-  { "PC", 32, 0 },
-  { "ICOUNT", 32, 0 },
-  { "DDR", 32, 0 },
-  { "INTERRUPT", 17, 0 },
-  { "CCOUNT", 32, 0 },
-  { "XTSYNC", 1, 0 },
-  { "EPC1", 32, 0 },
-  { "EPC2", 32, 0 },
-  { "EPC3", 32, 0 },
-  { "EPC4", 32, 0 },
-  { "EXCSAVE1", 32, 0 },
-  { "EXCSAVE2", 32, 0 },
-  { "EXCSAVE3", 32, 0 },
-  { "EXCSAVE4", 32, 0 },
-  { "EPS2", 13, 0 },
-  { "EPS3", 13, 0 },
-  { "EPS4", 13, 0 },
-  { "EXCCAUSE", 6, 0 },
-  { "PSINTLEVEL", 4, 0 },
-  { "PSUM", 1, 0 },
-  { "PSWOE", 1, 0 },
-  { "PSEXCM", 1, 0 },
-  { "DEPC", 32, 0 },
-  { "EXCVADDR", 32, 0 },
-  { "WindowBase", 4, 0 },
-  { "WindowStart", 16, 0 },
-  { "PSCALLINC", 2, 0 },
-  { "PSOWB", 4, 0 },
-  { "LBEG", 32, 0 },
-  { "LEND", 32, 0 },
-  { "SAR", 6, 0 },
-  { "LITBADDR", 20, 0 },
-  { "LITBEN", 1, 0 },
-  { "MISC0", 32, 0 },
-  { "MISC1", 32, 0 },
-  { "InOCDMode", 1, 0 },
-  { "INTENABLE", 17, 0 },
-  { "DBREAKA0", 32, 0 },
-  { "DBREAKC0", 8, 0 },
-  { "DBREAKA1", 32, 0 },
-  { "DBREAKC1", 8, 0 },
-  { "IBREAKA0", 32, 0 },
-  { "IBREAKA1", 32, 0 },
-  { "IBREAKENABLE", 2, 0 },
-  { "ICOUNTLEVEL", 4, 0 },
-  { "DEBUGCAUSE", 6, 0 },
-  { "DBNUM", 4, 0 },
-  { "CCOMPARE0", 32, 0 },
-  { "CCOMPARE1", 32, 0 },
-  { "CCOMPARE2", 32, 0 }
-};
-
-#define NUM_STATES 51
-
-/* Macros for xtensa_state numbers (for use in iclasses because the
-   state numbers are not available when the iclass table is generated).  */
-
-#define STATE_LCOUNT 0
-#define STATE_PC 1
-#define STATE_ICOUNT 2
-#define STATE_DDR 3
-#define STATE_INTERRUPT 4
-#define STATE_CCOUNT 5
-#define STATE_XTSYNC 6
-#define STATE_EPC1 7
-#define STATE_EPC2 8
-#define STATE_EPC3 9
-#define STATE_EPC4 10
-#define STATE_EXCSAVE1 11
-#define STATE_EXCSAVE2 12
-#define STATE_EXCSAVE3 13
-#define STATE_EXCSAVE4 14
-#define STATE_EPS2 15
-#define STATE_EPS3 16
-#define STATE_EPS4 17
-#define STATE_EXCCAUSE 18
-#define STATE_PSINTLEVEL 19
-#define STATE_PSUM 20
-#define STATE_PSWOE 21
-#define STATE_PSEXCM 22
-#define STATE_DEPC 23
-#define STATE_EXCVADDR 24
-#define STATE_WindowBase 25
-#define STATE_WindowStart 26
-#define STATE_PSCALLINC 27
-#define STATE_PSOWB 28
-#define STATE_LBEG 29
-#define STATE_LEND 30
-#define STATE_SAR 31
-#define STATE_LITBADDR 32
-#define STATE_LITBEN 33
-#define STATE_MISC0 34
-#define STATE_MISC1 35
-#define STATE_InOCDMode 36
-#define STATE_INTENABLE 37
-#define STATE_DBREAKA0 38
-#define STATE_DBREAKC0 39
-#define STATE_DBREAKA1 40
-#define STATE_DBREAKC1 41
-#define STATE_IBREAKA0 42
-#define STATE_IBREAKA1 43
-#define STATE_IBREAKENABLE 44
-#define STATE_ICOUNTLEVEL 45
-#define STATE_DEBUGCAUSE 46
-#define STATE_DBNUM 47
-#define STATE_CCOMPARE0 48
-#define STATE_CCOMPARE1 49
-#define STATE_CCOMPARE2 50
-
-
-/* Field definitions.  */
-
-static unsigned
-Field_t_Slot_inst_get (const xtensa_insnbuf insn)
+static uint32
+tie_do_reloc_l (uint32 addr, uint32 pc)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 12) >> 28);
-  return tie_t;
+  return (addr - pc);
 }
 
-static void
-Field_t_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+static uint32
+tie_undo_reloc_l (uint32 offset, uint32 pc)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0000) | (tie_t << 16);
+  return (pc + offset);
 }
 
-static unsigned
-Field_s_Slot_inst_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
-}
+xtensa_opcode_internal** get_opcodes (void);
+int get_num_opcodes (void);
+int decode_insn (const xtensa_insnbuf);
+int interface_version (void);
 
-static void
-Field_s_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
-}
+uint32 get_bbi_field (const xtensa_insnbuf);
+void set_bbi_field (xtensa_insnbuf, uint32);
+uint32 get_bbi4_field (const xtensa_insnbuf);
+void set_bbi4_field (xtensa_insnbuf, uint32);
+uint32 get_i_field (const xtensa_insnbuf);
+void set_i_field (xtensa_insnbuf, uint32);
+uint32 get_imm12_field (const xtensa_insnbuf);
+void set_imm12_field (xtensa_insnbuf, uint32);
+uint32 get_imm12b_field (const xtensa_insnbuf);
+void set_imm12b_field (xtensa_insnbuf, uint32);
+uint32 get_imm16_field (const xtensa_insnbuf);
+void set_imm16_field (xtensa_insnbuf, uint32);
+uint32 get_imm4_field (const xtensa_insnbuf);
+void set_imm4_field (xtensa_insnbuf, uint32);
+uint32 get_imm6_field (const xtensa_insnbuf);
+void set_imm6_field (xtensa_insnbuf, uint32);
+uint32 get_imm6hi_field (const xtensa_insnbuf);
+void set_imm6hi_field (xtensa_insnbuf, uint32);
+uint32 get_imm6lo_field (const xtensa_insnbuf);
+void set_imm6lo_field (xtensa_insnbuf, uint32);
+uint32 get_imm7_field (const xtensa_insnbuf);
+void set_imm7_field (xtensa_insnbuf, uint32);
+uint32 get_imm7hi_field (const xtensa_insnbuf);
+void set_imm7hi_field (xtensa_insnbuf, uint32);
+uint32 get_imm7lo_field (const xtensa_insnbuf);
+void set_imm7lo_field (xtensa_insnbuf, uint32);
+uint32 get_imm8_field (const xtensa_insnbuf);
+void set_imm8_field (xtensa_insnbuf, uint32);
+uint32 get_m_field (const xtensa_insnbuf);
+void set_m_field (xtensa_insnbuf, uint32);
+uint32 get_mn_field (const xtensa_insnbuf);
+void set_mn_field (xtensa_insnbuf, uint32);
+uint32 get_n_field (const xtensa_insnbuf);
+void set_n_field (xtensa_insnbuf, uint32);
+uint32 get_none_field (const xtensa_insnbuf);
+void set_none_field (xtensa_insnbuf, uint32);
+uint32 get_offset_field (const xtensa_insnbuf);
+void set_offset_field (xtensa_insnbuf, uint32);
+uint32 get_op0_field (const xtensa_insnbuf);
+void set_op0_field (xtensa_insnbuf, uint32);
+uint32 get_op1_field (const xtensa_insnbuf);
+void set_op1_field (xtensa_insnbuf, uint32);
+uint32 get_op2_field (const xtensa_insnbuf);
+void set_op2_field (xtensa_insnbuf, uint32);
+uint32 get_r_field (const xtensa_insnbuf);
+void set_r_field (xtensa_insnbuf, uint32);
+uint32 get_s_field (const xtensa_insnbuf);
+void set_s_field (xtensa_insnbuf, uint32);
+uint32 get_sa4_field (const xtensa_insnbuf);
+void set_sa4_field (xtensa_insnbuf, uint32);
+uint32 get_sae_field (const xtensa_insnbuf);
+void set_sae_field (xtensa_insnbuf, uint32);
+uint32 get_sae4_field (const xtensa_insnbuf);
+void set_sae4_field (xtensa_insnbuf, uint32);
+uint32 get_sal_field (const xtensa_insnbuf);
+void set_sal_field (xtensa_insnbuf, uint32);
+uint32 get_sar_field (const xtensa_insnbuf);
+void set_sar_field (xtensa_insnbuf, uint32);
+uint32 get_sas_field (const xtensa_insnbuf);
+void set_sas_field (xtensa_insnbuf, uint32);
+uint32 get_sas4_field (const xtensa_insnbuf);
+void set_sas4_field (xtensa_insnbuf, uint32);
+uint32 get_sr_field (const xtensa_insnbuf);
+void set_sr_field (xtensa_insnbuf, uint32);
+uint32 get_t_field (const xtensa_insnbuf);
+void set_t_field (xtensa_insnbuf, uint32);
+uint32 get_thi3_field (const xtensa_insnbuf);
+void set_thi3_field (xtensa_insnbuf, uint32);
+uint32 get_z_field (const xtensa_insnbuf);
+void set_z_field (xtensa_insnbuf, uint32);
 
-static unsigned
-Field_r_Slot_inst_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
-}
 
-static void
-Field_r_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_bbi_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
+  return ((insn[0] & 0xf0000) >> 16) |
+         ((insn[0] & 0x100) >> 4);
 }
 
-static unsigned
-Field_op2_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_bbi_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
+  insn[0] = (insn[0] & 0xfffffeff) | ((val << 4) & 0x100);
 }
 
-static void
-Field_op2_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_bbi4_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
+  return ((insn[0] & 0x100) >> 8);
 }
 
-static unsigned
-Field_op1_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_bbi4_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffffeff) | ((val << 8) & 0x100);
 }
 
-static void
-Field_op1_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_i_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
+  return ((insn[0] & 0x80000) >> 19);
 }
 
-static unsigned
-Field_op0_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_i_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 8) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff7ffff) | ((val << 19) & 0x80000);
 }
 
-static void
-Field_op0_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm12_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00000) | (tie_t << 20);
+  return ((insn[0] & 0xfff));
 }
 
-static unsigned
-Field_n_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_imm12_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 12) >> 30);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff000) | (val & 0xfff);
 }
 
-static void
-Field_n_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm12b_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 30) >> 30;
-  insn[0] = (insn[0] & ~0xc0000) | (tie_t << 18);
+  return ((insn[0] & 0xff)) |
+         ((insn[0] & 0xf000) >> 4);
 }
 
-static unsigned
-Field_m_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_imm12b_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 14) >> 30);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffffff00) | (val & 0xff);
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 4) & 0xf000);
 }
 
-static void
-Field_m_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm16_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 30) >> 30;
-  insn[0] = (insn[0] & ~0x30000) | (tie_t << 16);
+  return ((insn[0] & 0xffff));
 }
 
-static unsigned
-Field_sr_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_imm16_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffff0000) | (val & 0xffff);
 }
 
-static void
-Field_sr_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm4_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
+  return ((insn[0] & 0xf00) >> 8);
 }
 
-static unsigned
-Field_thi3_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_imm4_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 3) | ((insn[0] << 12) >> 29);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
 }
 
-static void
-Field_thi3_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm6_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 29) >> 29;
-  insn[0] = (insn[0] & ~0xe0000) | (tie_t << 17);
+  return ((insn[0] & 0xf00) >> 8) |
+         ((insn[0] & 0x30000) >> 12);
 }
 
-static unsigned
-Field_op0_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_imm6_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+  insn[0] = (insn[0] & 0xfffcffff) | ((val << 12) & 0x30000);
 }
 
-static void
-Field_op0_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm6hi_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
+  return ((insn[0] & 0x30000) >> 16);
 }
 
-static unsigned
-Field_t_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm6hi_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
 }
 
-static void
-Field_t_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm6lo_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
+  return ((insn[0] & 0xf00) >> 8);
 }
 
-static unsigned
-Field_r_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm6lo_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
 }
 
-static void
-Field_r_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm7_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
+  return ((insn[0] & 0xf00) >> 8) |
+         ((insn[0] & 0x70000) >> 12);
 }
 
-static unsigned
-Field_op0_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm7_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+  insn[0] = (insn[0] & 0xfff8ffff) | ((val << 12) & 0x70000);
 }
 
-static void
-Field_op0_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm7hi_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
+  return ((insn[0] & 0x70000) >> 16);
 }
 
-static unsigned
-Field_z_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm7hi_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 21) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff8ffff) | ((val << 16) & 0x70000);
 }
 
-static void
-Field_z_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm7lo_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x400) | (tie_t << 10);
+  return ((insn[0] & 0xf00) >> 8);
 }
 
-static unsigned
-Field_i_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm7lo_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 20) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
 }
 
-static void
-Field_i_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_imm8_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x800) | (tie_t << 11);
+  return ((insn[0] & 0xff));
 }
 
-static unsigned
-Field_s_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_imm8_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffffff00) | (val & 0xff);
 }
 
-static void
-Field_s_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_m_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
+  return ((insn[0] & 0x30000) >> 16);
 }
 
-static unsigned
-Field_t_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_m_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
 }
 
-static void
-Field_t_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_mn_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
+  return ((insn[0] & 0x30000) >> 16) |
+         ((insn[0] & 0xc0000) >> 16);
 }
 
-static unsigned
-Field_bbi4_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_mn_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 23) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
+  insn[0] = (insn[0] & 0xfff3ffff) | ((val << 16) & 0xc0000);
 }
 
-static void
-Field_bbi4_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_n_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x100) | (tie_t << 8);
+  return ((insn[0] & 0xc0000) >> 18);
 }
 
-static unsigned
-Field_bbi_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_n_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 23) >> 31);
-  tie_t = (tie_t << 4) | ((insn[0] << 12) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff3ffff) | ((val << 18) & 0xc0000);
 }
 
-static void
-Field_bbi_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_none_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0000) | (tie_t << 16);
-  tie_t = (val << 27) >> 31;
-  insn[0] = (insn[0] & ~0x100) | (tie_t << 8);
+  return ((insn[0] & 0x0));
 }
 
-static unsigned
-Field_imm12_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_none_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 12) | ((insn[0] << 20) >> 20);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffffffff) | (val & 0x0);
 }
 
-static void
-Field_imm12_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_offset_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 20) >> 20;
-  insn[0] = (insn[0] & ~0xfff) | (tie_t << 0);
+  return ((insn[0] & 0x3ffff));
 }
 
-static unsigned
-Field_imm8_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_offset_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 8) | ((insn[0] << 24) >> 24);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffc0000) | (val & 0x3ffff);
 }
 
-static void
-Field_imm8_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_op0_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 24) >> 24;
-  insn[0] = (insn[0] & ~0xff) | (tie_t << 0);
+  return ((insn[0] & 0xf00000) >> 20);
 }
 
-static unsigned
-Field_s_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_op0_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xff0fffff) | ((val << 20) & 0xf00000);
 }
 
-static void
-Field_s_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_op1_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
+  return ((insn[0] & 0xf0) >> 4);
 }
 
-static unsigned
-Field_imm12b_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_op1_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  tie_t = (tie_t << 8) | ((insn[0] << 24) >> 24);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffffff0f) | ((val << 4) & 0xf0);
 }
 
-static void
-Field_imm12b_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_op2_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 24) >> 24;
-  insn[0] = (insn[0] & ~0xff) | (tie_t << 0);
-  tie_t = (val << 20) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
+  return ((insn[0] & 0xf));
 }
 
-static unsigned
-Field_imm16_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_op2_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 16) | ((insn[0] << 16) >> 16);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffffff0) | (val & 0xf);
 }
 
-static void
-Field_imm16_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_r_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 16) >> 16;
-  insn[0] = (insn[0] & ~0xffff) | (tie_t << 0);
+  return ((insn[0] & 0xf00) >> 8);
 }
 
-static unsigned
-Field_offset_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_r_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 18) | ((insn[0] << 14) >> 14);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
 }
 
-static void
-Field_offset_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_s_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 14) >> 14;
-  insn[0] = (insn[0] & ~0x3ffff) | (tie_t << 0);
+  return ((insn[0] & 0xf000) >> 12);
 }
 
-static unsigned
-Field_r_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_s_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
 }
 
-static void
-Field_r_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sa4_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
+  return ((insn[0] & 0x1));
 }
 
-static unsigned
-Field_sa4_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sa4_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 31) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffffffe) | (val & 0x1);
 }
 
-static void
-Field_sa4_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sae_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x1) | (tie_t << 0);
+  return ((insn[0] & 0xf000) >> 12) |
+         ((insn[0] & 0x10));
 }
 
-static unsigned
-Field_sae4_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sae_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 27) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+  insn[0] = (insn[0] & 0xffffffef) | (val & 0x10);
 }
 
-static void
-Field_sae4_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sae4_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x10) | (tie_t << 4);
+  return ((insn[0] & 0x10) >> 4);
 }
 
-static unsigned
-Field_sae_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sae4_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 27) >> 31);
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffffffef) | ((val << 4) & 0x10);
 }
 
-static void
-Field_sae_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sal_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
-  tie_t = (val << 27) >> 31;
-  insn[0] = (insn[0] & ~0x10) | (tie_t << 4);
+  return ((insn[0] & 0xf0000) >> 16) |
+         ((insn[0] & 0x1) << 4);
 }
 
-static unsigned
-Field_sal_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sal_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 31) >> 31);
-  tie_t = (tie_t << 4) | ((insn[0] << 12) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
+  insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1);
 }
 
-static void
-Field_sal_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sar_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0000) | (tie_t << 16);
-  tie_t = (val << 27) >> 31;
-  insn[0] = (insn[0] & ~0x1) | (tie_t << 0);
+  return ((insn[0] & 0xf000) >> 12) |
+         ((insn[0] & 0x1) << 4);
 }
 
-static unsigned
-Field_sargt_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sar_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 31) >> 31);
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+  insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1);
 }
 
-static void
-Field_sargt_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sas_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
-  tie_t = (val << 27) >> 31;
-  insn[0] = (insn[0] & ~0x1) | (tie_t << 0);
+  return ((insn[0] & 0xf000) >> 12) |
+         ((insn[0] & 0x10000) >> 12);
 }
 
-static unsigned
-Field_sas4_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sas_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 15) >> 31);
-  return tie_t;
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+  insn[0] = (insn[0] & 0xfffeffff) | ((val << 12) & 0x10000);
 }
 
-static void
-Field_sas4_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sas4_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x10000) | (tie_t << 16);
+  return ((insn[0] & 0x10000) >> 16);
 }
 
-static unsigned
-Field_sas_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_sas4_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 15) >> 31);
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffeffff) | ((val << 16) & 0x10000);
 }
 
-static void
-Field_sas_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_sr_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
-  tie_t = (val << 27) >> 31;
-  insn[0] = (insn[0] & ~0x10000) | (tie_t << 16);
+  return ((insn[0] & 0xf00) >> 8) |
+         ((insn[0] & 0xf000) >> 8);
 }
 
-static unsigned
-Field_sr_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_sr_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+  insn[0] = (insn[0] & 0xffff0fff) | ((val << 8) & 0xf000);
 }
 
-static void
-Field_sr_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_t_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
+  return ((insn[0] & 0xf0000) >> 16);
 }
 
-static unsigned
-Field_sr_Slot_inst16b_get (const xtensa_insnbuf insn)
+void
+set_t_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
 }
 
-static void
-Field_sr_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_thi3_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
+  return ((insn[0] & 0xe0000) >> 17);
 }
 
-static unsigned
-Field_st_Slot_inst_get (const xtensa_insnbuf insn)
+void
+set_thi3_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 16) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 12) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfff1ffff) | ((val << 17) & 0xe0000);
 }
 
-static void
-Field_st_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
+uint32
+get_z_field (const xtensa_insnbuf insn)
 {
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf0000) | (tie_t << 16);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf000) | (tie_t << 12);
+  return ((insn[0] & 0x40000) >> 18);
 }
 
-static unsigned
-Field_st_Slot_inst16a_get (const xtensa_insnbuf insn)
+void
+set_z_field (xtensa_insnbuf insn, uint32 val)
 {
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
+  insn[0] = (insn[0] & 0xfffbffff) | ((val << 18) & 0x40000);
 }
 
-static void
-Field_st_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
-}
+uint32 decode_b4constu (uint32);
+xtensa_encode_result encode_b4constu (uint32 *);
+uint32 decode_simm8x256 (uint32);
+xtensa_encode_result encode_simm8x256 (uint32 *);
+uint32 decode_soffset (uint32);
+xtensa_encode_result encode_soffset (uint32 *);
+uint32 decode_imm4 (uint32);
+xtensa_encode_result encode_imm4 (uint32 *);
+uint32 decode_op0 (uint32);
+xtensa_encode_result encode_op0 (uint32 *);
+uint32 decode_op1 (uint32);
+xtensa_encode_result encode_op1 (uint32 *);
+uint32 decode_imm6 (uint32);
+xtensa_encode_result encode_imm6 (uint32 *);
+uint32 decode_op2 (uint32);
+xtensa_encode_result encode_op2 (uint32 *);
+uint32 decode_imm7 (uint32);
+xtensa_encode_result encode_imm7 (uint32 *);
+uint32 decode_simm4 (uint32);
+xtensa_encode_result encode_simm4 (uint32 *);
+uint32 decode_ai4const (uint32);
+xtensa_encode_result encode_ai4const (uint32 *);
+uint32 decode_imm8 (uint32);
+xtensa_encode_result encode_imm8 (uint32 *);
+uint32 decode_sae (uint32);
+xtensa_encode_result encode_sae (uint32 *);
+uint32 decode_imm7lo (uint32);
+xtensa_encode_result encode_imm7lo (uint32 *);
+uint32 decode_simm7 (uint32);
+xtensa_encode_result encode_simm7 (uint32 *);
+uint32 decode_simm8 (uint32);
+xtensa_encode_result encode_simm8 (uint32 *);
+uint32 decode_uimm12x8 (uint32);
+xtensa_encode_result encode_uimm12x8 (uint32 *);
+uint32 decode_sal (uint32);
+xtensa_encode_result encode_sal (uint32 *);
+uint32 decode_uimm6 (uint32);
+xtensa_encode_result encode_uimm6 (uint32 *);
+uint32 decode_sas4 (uint32);
+xtensa_encode_result encode_sas4 (uint32 *);
+uint32 decode_uimm8 (uint32);
+xtensa_encode_result encode_uimm8 (uint32 *);
+uint32 decode_uimm16x4 (uint32);
+xtensa_encode_result encode_uimm16x4 (uint32 *);
+uint32 decode_sar (uint32);
+xtensa_encode_result encode_sar (uint32 *);
+uint32 decode_sa4 (uint32);
+xtensa_encode_result encode_sa4 (uint32 *);
+uint32 decode_sas (uint32);
+xtensa_encode_result encode_sas (uint32 *);
+uint32 decode_imm6hi (uint32);
+xtensa_encode_result encode_imm6hi (uint32 *);
+uint32 decode_bbi (uint32);
+xtensa_encode_result encode_bbi (uint32 *);
+uint32 decode_uimm8x2 (uint32);
+xtensa_encode_result encode_uimm8x2 (uint32 *);
+uint32 decode_uimm8x4 (uint32);
+xtensa_encode_result encode_uimm8x4 (uint32 *);
+uint32 decode_msalp32 (uint32);
+xtensa_encode_result encode_msalp32 (uint32 *);
+uint32 decode_bbi4 (uint32);
+xtensa_encode_result encode_bbi4 (uint32 *);
+uint32 decode_op2p1 (uint32);
+xtensa_encode_result encode_op2p1 (uint32 *);
+uint32 decode_soffsetx4 (uint32);
+xtensa_encode_result encode_soffsetx4 (uint32 *);
+uint32 decode_imm6lo (uint32);
+xtensa_encode_result encode_imm6lo (uint32 *);
+uint32 decode_imm12 (uint32);
+xtensa_encode_result encode_imm12 (uint32 *);
+uint32 decode_b4const (uint32);
+xtensa_encode_result encode_b4const (uint32 *);
+uint32 decode_i (uint32);
+xtensa_encode_result encode_i (uint32 *);
+uint32 decode_imm16 (uint32);
+xtensa_encode_result encode_imm16 (uint32 *);
+uint32 decode_mn (uint32);
+xtensa_encode_result encode_mn (uint32 *);
+uint32 decode_m (uint32);
+xtensa_encode_result encode_m (uint32 *);
+uint32 decode_n (uint32);
+xtensa_encode_result encode_n (uint32 *);
+uint32 decode_none (uint32);
+xtensa_encode_result encode_none (uint32 *);
+uint32 decode_imm12b (uint32);
+xtensa_encode_result encode_imm12b (uint32 *);
+uint32 decode_r (uint32);
+xtensa_encode_result encode_r (uint32 *);
+uint32 decode_s (uint32);
+xtensa_encode_result encode_s (uint32 *);
+uint32 decode_t (uint32);
+xtensa_encode_result encode_t (uint32 *);
+uint32 decode_thi3 (uint32);
+xtensa_encode_result encode_thi3 (uint32 *);
+uint32 decode_sae4 (uint32);
+xtensa_encode_result encode_sae4 (uint32 *);
+uint32 decode_offset (uint32);
+xtensa_encode_result encode_offset (uint32 *);
+uint32 decode_imm7hi (uint32);
+xtensa_encode_result encode_imm7hi (uint32 *);
+uint32 decode_uimm4x16 (uint32);
+xtensa_encode_result encode_uimm4x16 (uint32 *);
+uint32 decode_simm12b (uint32);
+xtensa_encode_result encode_simm12b (uint32 *);
+uint32 decode_lsi4x4 (uint32);
+xtensa_encode_result encode_lsi4x4 (uint32 *);
+uint32 decode_z (uint32);
+xtensa_encode_result encode_z (uint32 *);
+uint32 decode_simm12 (uint32);
+xtensa_encode_result encode_simm12 (uint32 *);
+uint32 decode_sr (uint32);
+xtensa_encode_result encode_sr (uint32 *);
+uint32 decode_nimm4x2 (uint32);
+xtensa_encode_result encode_nimm4x2 (uint32 *);
 
-static unsigned
-Field_st_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 24) >> 28);
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
-}
 
-static void
-Field_st_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
-  tie_t = (val << 24) >> 28;
-  insn[0] = (insn[0] & ~0xf0) | (tie_t << 4);
-}
-
-static unsigned
-Field_imm4_Slot_inst_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 20) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm4_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf00) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm4_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm4_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_imm4_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm4_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_mn_Slot_inst_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 12) >> 30);
-  tie_t = (tie_t << 2) | ((insn[0] << 14) >> 30);
-  return tie_t;
-}
-
-static void
-Field_mn_Slot_inst_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 30) >> 30;
-  insn[0] = (insn[0] & ~0x30000) | (tie_t << 16);
-  tie_t = (val << 28) >> 30;
-  insn[0] = (insn[0] & ~0xc0000) | (tie_t << 18);
-}
-
-static unsigned
-Field_i_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 20) >> 31);
-  return tie_t;
-}
-
-static void
-Field_i_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x800) | (tie_t << 11);
-}
-
-static unsigned
-Field_imm6lo_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm6lo_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_imm6lo_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm6lo_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_imm6hi_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 22) >> 30);
-  return tie_t;
-}
-
-static void
-Field_imm6hi_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 30) >> 30;
-  insn[0] = (insn[0] & ~0x300) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm6hi_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 22) >> 30);
-  return tie_t;
-}
-
-static void
-Field_imm6hi_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 30) >> 30;
-  insn[0] = (insn[0] & ~0x300) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm7lo_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm7lo_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_imm7lo_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm7lo_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-}
-
-static unsigned
-Field_imm7hi_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 3) | ((insn[0] << 21) >> 29);
-  return tie_t;
-}
-
-static void
-Field_imm7hi_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 29) >> 29;
-  insn[0] = (insn[0] & ~0x700) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm7hi_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 3) | ((insn[0] << 21) >> 29);
-  return tie_t;
-}
-
-static void
-Field_imm7hi_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 29) >> 29;
-  insn[0] = (insn[0] & ~0x700) | (tie_t << 8);
-}
-
-static unsigned
-Field_z_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 1) | ((insn[0] << 21) >> 31);
-  return tie_t;
-}
-
-static void
-Field_z_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 31) >> 31;
-  insn[0] = (insn[0] & ~0x400) | (tie_t << 10);
-}
-
-static unsigned
-Field_imm6_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 22) >> 30);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm6_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 26) >> 30;
-  insn[0] = (insn[0] & ~0x300) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm6_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 2) | ((insn[0] << 22) >> 30);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm6_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 26) >> 30;
-  insn[0] = (insn[0] & ~0x300) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm7_Slot_inst16a_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 3) | ((insn[0] << 21) >> 29);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm7_Slot_inst16a_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 25) >> 29;
-  insn[0] = (insn[0] & ~0x700) | (tie_t << 8);
-}
-
-static unsigned
-Field_imm7_Slot_inst16b_get (const xtensa_insnbuf insn)
-{
-  unsigned tie_t = 0;
-  tie_t = (tie_t << 3) | ((insn[0] << 21) >> 29);
-  tie_t = (tie_t << 4) | ((insn[0] << 28) >> 28);
-  return tie_t;
-}
-
-static void
-Field_imm7_Slot_inst16b_set (xtensa_insnbuf insn, uint32 val)
-{
-  uint32 tie_t;
-  tie_t = (val << 28) >> 28;
-  insn[0] = (insn[0] & ~0xf) | (tie_t << 0);
-  tie_t = (val << 25) >> 29;
-  insn[0] = (insn[0] & ~0x700) | (tie_t << 8);
-}
-
-static void
-Implicit_Field_set (xtensa_insnbuf insn ATTRIBUTE_UNUSED,
-		    uint32 val ATTRIBUTE_UNUSED)
-{
-  /* Do nothing.  */
-}
-
-static unsigned
-Implicit_Field_ar0_get (const xtensa_insnbuf insn ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static unsigned
-Implicit_Field_ar4_get (const xtensa_insnbuf insn ATTRIBUTE_UNUSED)
-{
-  return 4;
-}
-
-static unsigned
-Implicit_Field_ar8_get (const xtensa_insnbuf insn ATTRIBUTE_UNUSED)
-{
-  return 8;
-}
-
-static unsigned
-Implicit_Field_ar12_get (const xtensa_insnbuf insn ATTRIBUTE_UNUSED)
-{
-  return 12;
-}
-
-
-/* Functional units.  */
-
-static xtensa_funcUnit_internal funcUnits[] = {
-
-};
-
-
-/* Register files.  */
-
-static xtensa_regfile_internal regfiles[] = {
-  { "AR", "a", 0, 32, 64 }
-};
-
-
-/* Interfaces.  */
-
-static xtensa_interface_internal interfaces[] = {
-
-};
-
-
-/* Constant tables.  */
-
-/* constant table ai4c */
-static const unsigned CONST_TBL_ai4c_0[] = {
-  0xffffffff,
-  0x1,
-  0x2,
-  0x3,
-  0x4,
-  0x5,
-  0x6,
-  0x7,
-  0x8,
-  0x9,
-  0xa,
-  0xb,
-  0xc,
-  0xd,
-  0xe,
-  0xf,
-  0
-};
-
-/* constant table b4c */
-static const unsigned CONST_TBL_b4c_0[] = {
-  0xffffffff,
-  0x1,
-  0x2,
-  0x3,
-  0x4,
-  0x5,
-  0x6,
-  0x7,
-  0x8,
-  0xa,
-  0xc,
-  0x10,
-  0x20,
-  0x40,
-  0x80,
-  0x100,
-  0
-};
-
-/* constant table b4cu */
-static const unsigned CONST_TBL_b4cu_0[] = {
-  0x8000,
-  0x10000,
-  0x2,
-  0x3,
-  0x4,
-  0x5,
-  0x6,
-  0x7,
-  0x8,
-  0xa,
-  0xc,
-  0x10,
-  0x20,
-  0x40,
-  0x80,
-  0x100,
-  0
-};
-
-
-/* Instruction operands.  */
-
-static int
-Operand_soffsetx4_decode (uint32 *valp)
-{
-  unsigned soffsetx4_0, offset_0;
-  offset_0 = *valp & 0x3ffff;
-  soffsetx4_0 = 0x4 + ((((int) offset_0 << 14) >> 14) << 2);
-  *valp = soffsetx4_0;
-  return 0;
-}
-
-static int
-Operand_soffsetx4_encode (uint32 *valp)
-{
-  unsigned offset_0, soffsetx4_0;
-  soffsetx4_0 = *valp;
-  offset_0 = ((soffsetx4_0 - 0x4) >> 2) & 0x3ffff;
-  *valp = offset_0;
-  return 0;
-}
-
-static int
-Operand_soffsetx4_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= (pc & ~0x3);
-  return 0;
-}
-
-static int
-Operand_soffsetx4_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += (pc & ~0x3);
-  return 0;
-}
-
-static int
-Operand_uimm12x8_decode (uint32 *valp)
-{
-  unsigned uimm12x8_0, imm12_0;
-  imm12_0 = *valp & 0xfff;
-  uimm12x8_0 = imm12_0 << 3;
-  *valp = uimm12x8_0;
-  return 0;
-}
-
-static int
-Operand_uimm12x8_encode (uint32 *valp)
-{
-  unsigned imm12_0, uimm12x8_0;
-  uimm12x8_0 = *valp;
-  imm12_0 = ((uimm12x8_0 >> 3) & 0xfff);
-  *valp = imm12_0;
-  return 0;
-}
-
-static int
-Operand_simm4_decode (uint32 *valp)
-{
-  unsigned simm4_0, mn_0;
-  mn_0 = *valp & 0xf;
-  simm4_0 = ((int) mn_0 << 28) >> 28;
-  *valp = simm4_0;
-  return 0;
-}
-
-static int
-Operand_simm4_encode (uint32 *valp)
-{
-  unsigned mn_0, simm4_0;
-  simm4_0 = *valp;
-  mn_0 = (simm4_0 & 0xf);
-  *valp = mn_0;
-  return 0;
-}
-
-static int
-Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_arr_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
-}
-
-static int
-Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ars_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
-}
-
-static int
-Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_art_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
-}
-
-static int
-Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ar0_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
-}
-
-static int
-Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ar4_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
-}
-
-static int
-Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ar8_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
-}
-
-static int
-Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ar12_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
-}
-
-static int
-Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-static int
-Operand_ars_entry_encode (uint32 *valp)
-{
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
-}
-
-static int
-Operand_immrx4_decode (uint32 *valp)
-{
-  unsigned immrx4_0, r_0;
-  r_0 = *valp & 0xf;
-  immrx4_0 = ((((0xfffffff)) << 4) | r_0) << 2;
-  *valp = immrx4_0;
-  return 0;
-}
-
-static int
-Operand_immrx4_encode (uint32 *valp)
-{
-  unsigned r_0, immrx4_0;
-  immrx4_0 = *valp;
-  r_0 = ((immrx4_0 >> 2) & 0xf);
-  *valp = r_0;
-  return 0;
-}
-
-static int
-Operand_lsi4x4_decode (uint32 *valp)
-{
-  unsigned lsi4x4_0, r_0;
-  r_0 = *valp & 0xf;
-  lsi4x4_0 = r_0 << 2;
-  *valp = lsi4x4_0;
-  return 0;
-}
-
-static int
-Operand_lsi4x4_encode (uint32 *valp)
-{
-  unsigned r_0, lsi4x4_0;
-  lsi4x4_0 = *valp;
-  r_0 = ((lsi4x4_0 >> 2) & 0xf);
-  *valp = r_0;
-  return 0;
-}
-
-static int
-Operand_simm7_decode (uint32 *valp)
-{
-  unsigned simm7_0, imm7_0;
-  imm7_0 = *valp & 0x7f;
-  simm7_0 = ((((-((((imm7_0 >> 6) & 1)) & (((imm7_0 >> 5) & 1)))) & 0x1ffffff)) << 7) | imm7_0;
-  *valp = simm7_0;
-  return 0;
-}
-
-static int
-Operand_simm7_encode (uint32 *valp)
-{
-  unsigned imm7_0, simm7_0;
-  simm7_0 = *valp;
-  imm7_0 = (simm7_0 & 0x7f);
-  *valp = imm7_0;
-  return 0;
-}
-
-static int
-Operand_uimm6_decode (uint32 *valp)
-{
-  unsigned uimm6_0, imm6_0;
-  imm6_0 = *valp & 0x3f;
-  uimm6_0 = 0x4 + ((((0)) << 6) | imm6_0);
-  *valp = uimm6_0;
-  return 0;
-}
-
-static int
-Operand_uimm6_encode (uint32 *valp)
-{
-  unsigned imm6_0, uimm6_0;
-  uimm6_0 = *valp;
-  imm6_0 = (uimm6_0 - 0x4) & 0x3f;
-  *valp = imm6_0;
-  return 0;
-}
-
-static int
-Operand_uimm6_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= pc;
-  return 0;
-}
-
-static int
-Operand_uimm6_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += pc;
-  return 0;
-}
-
-static int
-Operand_ai4const_decode (uint32 *valp)
-{
-  unsigned ai4const_0, t_0;
-  t_0 = *valp & 0xf;
-  ai4const_0 = CONST_TBL_ai4c_0[t_0 & 0xf];
-  *valp = ai4const_0;
-  return 0;
-}
-
-static int
-Operand_ai4const_encode (uint32 *valp)
-{
-  unsigned t_0, ai4const_0;
-  ai4const_0 = *valp;
-  switch (ai4const_0)
-    {
-    case 0xffffffff: t_0 = 0; break;
-    case 0x1: t_0 = 0x1; break;
-    case 0x2: t_0 = 0x2; break;
-    case 0x3: t_0 = 0x3; break;
-    case 0x4: t_0 = 0x4; break;
-    case 0x5: t_0 = 0x5; break;
-    case 0x6: t_0 = 0x6; break;
-    case 0x7: t_0 = 0x7; break;
-    case 0x8: t_0 = 0x8; break;
-    case 0x9: t_0 = 0x9; break;
-    case 0xa: t_0 = 0xa; break;
-    case 0xb: t_0 = 0xb; break;
-    case 0xc: t_0 = 0xc; break;
-    case 0xd: t_0 = 0xd; break;
-    case 0xe: t_0 = 0xe; break;
-    default: t_0 = 0xf; break;
-    }
-  *valp = t_0;
-  return 0;
-}
-
-static int
-Operand_b4const_decode (uint32 *valp)
-{
-  unsigned b4const_0, r_0;
-  r_0 = *valp & 0xf;
-  b4const_0 = CONST_TBL_b4c_0[r_0 & 0xf];
-  *valp = b4const_0;
-  return 0;
-}
-
-static int
-Operand_b4const_encode (uint32 *valp)
-{
-  unsigned r_0, b4const_0;
-  b4const_0 = *valp;
-  switch (b4const_0)
-    {
-    case 0xffffffff: r_0 = 0; break;
-    case 0x1: r_0 = 0x1; break;
-    case 0x2: r_0 = 0x2; break;
-    case 0x3: r_0 = 0x3; break;
-    case 0x4: r_0 = 0x4; break;
-    case 0x5: r_0 = 0x5; break;
-    case 0x6: r_0 = 0x6; break;
-    case 0x7: r_0 = 0x7; break;
-    case 0x8: r_0 = 0x8; break;
-    case 0xa: r_0 = 0x9; break;
-    case 0xc: r_0 = 0xa; break;
-    case 0x10: r_0 = 0xb; break;
-    case 0x20: r_0 = 0xc; break;
-    case 0x40: r_0 = 0xd; break;
-    case 0x80: r_0 = 0xe; break;
-    default: r_0 = 0xf; break;
-    }
-  *valp = r_0;
-  return 0;
-}
-
-static int
-Operand_b4constu_decode (uint32 *valp)
-{
-  unsigned b4constu_0, r_0;
-  r_0 = *valp & 0xf;
-  b4constu_0 = CONST_TBL_b4cu_0[r_0 & 0xf];
-  *valp = b4constu_0;
-  return 0;
-}
-
-static int
-Operand_b4constu_encode (uint32 *valp)
-{
-  unsigned r_0, b4constu_0;
-  b4constu_0 = *valp;
-  switch (b4constu_0)
-    {
-    case 0x8000: r_0 = 0; break;
-    case 0x10000: r_0 = 0x1; break;
-    case 0x2: r_0 = 0x2; break;
-    case 0x3: r_0 = 0x3; break;
-    case 0x4: r_0 = 0x4; break;
-    case 0x5: r_0 = 0x5; break;
-    case 0x6: r_0 = 0x6; break;
-    case 0x7: r_0 = 0x7; break;
-    case 0x8: r_0 = 0x8; break;
-    case 0xa: r_0 = 0x9; break;
-    case 0xc: r_0 = 0xa; break;
-    case 0x10: r_0 = 0xb; break;
-    case 0x20: r_0 = 0xc; break;
-    case 0x40: r_0 = 0xd; break;
-    case 0x80: r_0 = 0xe; break;
-    default: r_0 = 0xf; break;
-    }
-  *valp = r_0;
-  return 0;
-}
-
-static int
-Operand_uimm8_decode (uint32 *valp)
-{
-  unsigned uimm8_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  uimm8_0 = imm8_0;
-  *valp = uimm8_0;
-  return 0;
-}
-
-static int
-Operand_uimm8_encode (uint32 *valp)
-{
-  unsigned imm8_0, uimm8_0;
-  uimm8_0 = *valp;
-  imm8_0 = (uimm8_0 & 0xff);
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_uimm8x2_decode (uint32 *valp)
-{
-  unsigned uimm8x2_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  uimm8x2_0 = imm8_0 << 1;
-  *valp = uimm8x2_0;
-  return 0;
-}
-
-static int
-Operand_uimm8x2_encode (uint32 *valp)
-{
-  unsigned imm8_0, uimm8x2_0;
-  uimm8x2_0 = *valp;
-  imm8_0 = ((uimm8x2_0 >> 1) & 0xff);
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_uimm8x4_decode (uint32 *valp)
-{
-  unsigned uimm8x4_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  uimm8x4_0 = imm8_0 << 2;
-  *valp = uimm8x4_0;
-  return 0;
-}
-
-static int
-Operand_uimm8x4_encode (uint32 *valp)
-{
-  unsigned imm8_0, uimm8x4_0;
-  uimm8x4_0 = *valp;
-  imm8_0 = ((uimm8x4_0 >> 2) & 0xff);
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_uimm4x16_decode (uint32 *valp)
-{
-  unsigned uimm4x16_0, op2_0;
-  op2_0 = *valp & 0xf;
-  uimm4x16_0 = op2_0 << 4;
-  *valp = uimm4x16_0;
-  return 0;
-}
-
-static int
-Operand_uimm4x16_encode (uint32 *valp)
-{
-  unsigned op2_0, uimm4x16_0;
-  uimm4x16_0 = *valp;
-  op2_0 = ((uimm4x16_0 >> 4) & 0xf);
-  *valp = op2_0;
-  return 0;
-}
-
-static int
-Operand_simm8_decode (uint32 *valp)
-{
-  unsigned simm8_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  simm8_0 = ((int) imm8_0 << 24) >> 24;
-  *valp = simm8_0;
-  return 0;
-}
-
-static int
-Operand_simm8_encode (uint32 *valp)
-{
-  unsigned imm8_0, simm8_0;
-  simm8_0 = *valp;
-  imm8_0 = (simm8_0 & 0xff);
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_simm8x256_decode (uint32 *valp)
-{
-  unsigned simm8x256_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  simm8x256_0 = (((int) imm8_0 << 24) >> 24) << 8;
-  *valp = simm8x256_0;
-  return 0;
-}
-
-static int
-Operand_simm8x256_encode (uint32 *valp)
-{
-  unsigned imm8_0, simm8x256_0;
-  simm8x256_0 = *valp;
-  imm8_0 = ((simm8x256_0 >> 8) & 0xff);
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_simm12b_decode (uint32 *valp)
-{
-  unsigned simm12b_0, imm12b_0;
-  imm12b_0 = *valp & 0xfff;
-  simm12b_0 = ((int) imm12b_0 << 20) >> 20;
-  *valp = simm12b_0;
-  return 0;
-}
-
-static int
-Operand_simm12b_encode (uint32 *valp)
-{
-  unsigned imm12b_0, simm12b_0;
-  simm12b_0 = *valp;
-  imm12b_0 = (simm12b_0 & 0xfff);
-  *valp = imm12b_0;
-  return 0;
-}
-
-static int
-Operand_msalp32_decode (uint32 *valp)
-{
-  unsigned msalp32_0, sal_0;
-  sal_0 = *valp & 0x1f;
-  msalp32_0 = 0x20 - sal_0;
-  *valp = msalp32_0;
-  return 0;
-}
-
-static int
-Operand_msalp32_encode (uint32 *valp)
-{
-  unsigned sal_0, msalp32_0;
-  msalp32_0 = *valp;
-  sal_0 = (0x20 - msalp32_0) & 0x1f;
-  *valp = sal_0;
-  return 0;
-}
-
-static int
-Operand_op2p1_decode (uint32 *valp)
-{
-  unsigned op2p1_0, op2_0;
-  op2_0 = *valp & 0xf;
-  op2p1_0 = op2_0 + 0x1;
-  *valp = op2p1_0;
-  return 0;
-}
-
-static int
-Operand_op2p1_encode (uint32 *valp)
-{
-  unsigned op2_0, op2p1_0;
-  op2p1_0 = *valp;
-  op2_0 = (op2p1_0 - 0x1) & 0xf;
-  *valp = op2_0;
-  return 0;
-}
-
-static int
-Operand_label8_decode (uint32 *valp)
-{
-  unsigned label8_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  label8_0 = 0x4 + (((int) imm8_0 << 24) >> 24);
-  *valp = label8_0;
-  return 0;
-}
-
-static int
-Operand_label8_encode (uint32 *valp)
-{
-  unsigned imm8_0, label8_0;
-  label8_0 = *valp;
-  imm8_0 = (label8_0 - 0x4) & 0xff;
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_label8_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= pc;
-  return 0;
-}
-
-static int
-Operand_label8_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += pc;
-  return 0;
-}
-
-static int
-Operand_ulabel8_decode (uint32 *valp)
-{
-  unsigned ulabel8_0, imm8_0;
-  imm8_0 = *valp & 0xff;
-  ulabel8_0 = 0x4 + ((((0)) << 8) | imm8_0);
-  *valp = ulabel8_0;
-  return 0;
-}
-
-static int
-Operand_ulabel8_encode (uint32 *valp)
-{
-  unsigned imm8_0, ulabel8_0;
-  ulabel8_0 = *valp;
-  imm8_0 = (ulabel8_0 - 0x4) & 0xff;
-  *valp = imm8_0;
-  return 0;
-}
-
-static int
-Operand_ulabel8_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= pc;
-  return 0;
-}
-
-static int
-Operand_ulabel8_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += pc;
-  return 0;
-}
-
-static int
-Operand_label12_decode (uint32 *valp)
-{
-  unsigned label12_0, imm12_0;
-  imm12_0 = *valp & 0xfff;
-  label12_0 = 0x4 + (((int) imm12_0 << 20) >> 20);
-  *valp = label12_0;
-  return 0;
-}
-
-static int
-Operand_label12_encode (uint32 *valp)
-{
-  unsigned imm12_0, label12_0;
-  label12_0 = *valp;
-  imm12_0 = (label12_0 - 0x4) & 0xfff;
-  *valp = imm12_0;
-  return 0;
-}
-
-static int
-Operand_label12_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= pc;
-  return 0;
-}
-
-static int
-Operand_label12_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += pc;
-  return 0;
-}
-
-static int
-Operand_soffset_decode (uint32 *valp)
-{
-  unsigned soffset_0, offset_0;
-  offset_0 = *valp & 0x3ffff;
-  soffset_0 = 0x4 + (((int) offset_0 << 14) >> 14);
-  *valp = soffset_0;
-  return 0;
-}
-
-static int
-Operand_soffset_encode (uint32 *valp)
-{
-  unsigned offset_0, soffset_0;
-  soffset_0 = *valp;
-  offset_0 = (soffset_0 - 0x4) & 0x3ffff;
-  *valp = offset_0;
-  return 0;
-}
-
-static int
-Operand_soffset_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= pc;
-  return 0;
-}
-
-static int
-Operand_soffset_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += pc;
-  return 0;
-}
-
-static int
-Operand_uimm16x4_decode (uint32 *valp)
-{
-  unsigned uimm16x4_0, imm16_0;
-  imm16_0 = *valp & 0xffff;
-  uimm16x4_0 = ((((0xffff)) << 16) | imm16_0) << 2;
-  *valp = uimm16x4_0;
-  return 0;
-}
-
-static int
-Operand_uimm16x4_encode (uint32 *valp)
-{
-  unsigned imm16_0, uimm16x4_0;
-  uimm16x4_0 = *valp;
-  imm16_0 = (uimm16x4_0 >> 2) & 0xffff;
-  *valp = imm16_0;
-  return 0;
-}
-
-static int
-Operand_uimm16x4_ator (uint32 *valp, uint32 pc)
-{
-  *valp -= ((pc + 3) & ~0x3);
-  return 0;
-}
-
-static int
-Operand_uimm16x4_rtoa (uint32 *valp, uint32 pc)
-{
-  *valp += ((pc + 3) & ~0x3);
-  return 0;
-}
-
-static int
-Operand_immt_decode (uint32 *valp)
-{
-  unsigned immt_0, t_0;
-  t_0 = *valp & 0xf;
-  immt_0 = t_0;
-  *valp = immt_0;
-  return 0;
-}
-
-static int
-Operand_immt_encode (uint32 *valp)
-{
-  unsigned t_0, immt_0;
-  immt_0 = *valp;
-  t_0 = immt_0 & 0xf;
-  *valp = t_0;
-  return 0;
-}
-
-static int
-Operand_imms_decode (uint32 *valp)
-{
-  unsigned imms_0, s_0;
-  s_0 = *valp & 0xf;
-  imms_0 = s_0;
-  *valp = imms_0;
-  return 0;
-}
-
-static int
-Operand_imms_encode (uint32 *valp)
-{
-  unsigned s_0, imms_0;
-  imms_0 = *valp;
-  s_0 = imms_0 & 0xf;
-  *valp = s_0;
-  return 0;
-}
-
-static xtensa_operand_internal operands[] = {
-  { "soffsetx4", 10, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_soffsetx4_encode, Operand_soffsetx4_decode,
-    Operand_soffsetx4_ator, Operand_soffsetx4_rtoa },
-  { "uimm12x8", 3, -1, 0,
-    0,
-    Operand_uimm12x8_encode, Operand_uimm12x8_decode,
-    0, 0 },
-  { "simm4", 26, -1, 0,
-    0,
-    Operand_simm4_encode, Operand_simm4_decode,
-    0, 0 },
-  { "arr", 14, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER,
-    Operand_arr_encode, Operand_arr_decode,
-    0, 0 },
-  { "ars", 5, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER,
-    Operand_ars_encode, Operand_ars_decode,
-    0, 0 },
-  { "*ars_invisible", 5, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER | XTENSA_OPERAND_IS_INVISIBLE,
-    Operand_ars_encode, Operand_ars_decode,
-    0, 0 },
-  { "art", 0, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER,
-    Operand_art_encode, Operand_art_decode,
-    0, 0 },
-  { "ar0", 35, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER | XTENSA_OPERAND_IS_INVISIBLE,
-    Operand_ar0_encode, Operand_ar0_decode,
-    0, 0 },
-  { "ar4", 36, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER | XTENSA_OPERAND_IS_INVISIBLE,
-    Operand_ar4_encode, Operand_ar4_decode,
-    0, 0 },
-  { "ar8", 37, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER | XTENSA_OPERAND_IS_INVISIBLE,
-    Operand_ar8_encode, Operand_ar8_decode,
-    0, 0 },
-  { "ar12", 38, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER | XTENSA_OPERAND_IS_INVISIBLE,
-    Operand_ar12_encode, Operand_ar12_decode,
-    0, 0 },
-  { "ars_entry", 5, 0, 1,
-    XTENSA_OPERAND_IS_REGISTER,
-    Operand_ars_entry_encode, Operand_ars_entry_decode,
-    0, 0 },
-  { "immrx4", 14, -1, 0,
-    0,
-    Operand_immrx4_encode, Operand_immrx4_decode,
-    0, 0 },
-  { "lsi4x4", 14, -1, 0,
-    0,
-    Operand_lsi4x4_encode, Operand_lsi4x4_decode,
-    0, 0 },
-  { "simm7", 34, -1, 0,
-    0,
-    Operand_simm7_encode, Operand_simm7_decode,
-    0, 0 },
-  { "uimm6", 33, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_uimm6_encode, Operand_uimm6_decode,
-    Operand_uimm6_ator, Operand_uimm6_rtoa },
-  { "ai4const", 0, -1, 0,
-    0,
-    Operand_ai4const_encode, Operand_ai4const_decode,
-    0, 0 },
-  { "b4const", 14, -1, 0,
-    0,
-    Operand_b4const_encode, Operand_b4const_decode,
-    0, 0 },
-  { "b4constu", 14, -1, 0,
-    0,
-    Operand_b4constu_encode, Operand_b4constu_decode,
-    0, 0 },
-  { "uimm8", 4, -1, 0,
-    0,
-    Operand_uimm8_encode, Operand_uimm8_decode,
-    0, 0 },
-  { "uimm8x2", 4, -1, 0,
-    0,
-    Operand_uimm8x2_encode, Operand_uimm8x2_decode,
-    0, 0 },
-  { "uimm8x4", 4, -1, 0,
-    0,
-    Operand_uimm8x4_encode, Operand_uimm8x4_decode,
-    0, 0 },
-  { "uimm4x16", 13, -1, 0,
-    0,
-    Operand_uimm4x16_encode, Operand_uimm4x16_decode,
-    0, 0 },
-  { "simm8", 4, -1, 0,
-    0,
-    Operand_simm8_encode, Operand_simm8_decode,
-    0, 0 },
-  { "simm8x256", 4, -1, 0,
-    0,
-    Operand_simm8x256_encode, Operand_simm8x256_decode,
-    0, 0 },
-  { "simm12b", 6, -1, 0,
-    0,
-    Operand_simm12b_encode, Operand_simm12b_decode,
-    0, 0 },
-  { "msalp32", 18, -1, 0,
-    0,
-    Operand_msalp32_encode, Operand_msalp32_decode,
-    0, 0 },
-  { "op2p1", 13, -1, 0,
-    0,
-    Operand_op2p1_encode, Operand_op2p1_decode,
-    0, 0 },
-  { "label8", 4, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_label8_encode, Operand_label8_decode,
-    Operand_label8_ator, Operand_label8_rtoa },
-  { "ulabel8", 4, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_ulabel8_encode, Operand_ulabel8_decode,
-    Operand_ulabel8_ator, Operand_ulabel8_rtoa },
-  { "label12", 3, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_label12_encode, Operand_label12_decode,
-    Operand_label12_ator, Operand_label12_rtoa },
-  { "soffset", 10, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_soffset_encode, Operand_soffset_decode,
-    Operand_soffset_ator, Operand_soffset_rtoa },
-  { "uimm16x4", 7, -1, 0,
-    XTENSA_OPERAND_IS_PCRELATIVE,
-    Operand_uimm16x4_encode, Operand_uimm16x4_decode,
-    Operand_uimm16x4_ator, Operand_uimm16x4_rtoa },
-  { "immt", 0, -1, 0,
-    0,
-    Operand_immt_encode, Operand_immt_decode,
-    0, 0 },
-  { "imms", 5, -1, 0,
-    0,
-    Operand_imms_encode, Operand_imms_decode,
-    0, 0 },
-  { "t", 0, -1, 0, 0, 0, 0, 0, 0 },
-  { "bbi4", 1, -1, 0, 0, 0, 0, 0, 0 },
-  { "bbi", 2, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm12", 3, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm8", 4, -1, 0, 0, 0, 0, 0, 0 },
-  { "s", 5, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm12b", 6, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm16", 7, -1, 0, 0, 0, 0, 0, 0 },
-  { "m", 8, -1, 0, 0, 0, 0, 0, 0 },
-  { "n", 9, -1, 0, 0, 0, 0, 0, 0 },
-  { "offset", 10, -1, 0, 0, 0, 0, 0, 0 },
-  { "op0", 11, -1, 0, 0, 0, 0, 0, 0 },
-  { "op1", 12, -1, 0, 0, 0, 0, 0, 0 },
-  { "op2", 13, -1, 0, 0, 0, 0, 0, 0 },
-  { "r", 14, -1, 0, 0, 0, 0, 0, 0 },
-  { "sa4", 15, -1, 0, 0, 0, 0, 0, 0 },
-  { "sae4", 16, -1, 0, 0, 0, 0, 0, 0 },
-  { "sae", 17, -1, 0, 0, 0, 0, 0, 0 },
-  { "sal", 18, -1, 0, 0, 0, 0, 0, 0 },
-  { "sargt", 19, -1, 0, 0, 0, 0, 0, 0 },
-  { "sas4", 20, -1, 0, 0, 0, 0, 0, 0 },
-  { "sas", 21, -1, 0, 0, 0, 0, 0, 0 },
-  { "sr", 22, -1, 0, 0, 0, 0, 0, 0 },
-  { "st", 23, -1, 0, 0, 0, 0, 0, 0 },
-  { "thi3", 24, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm4", 25, -1, 0, 0, 0, 0, 0, 0 },
-  { "mn", 26, -1, 0, 0, 0, 0, 0, 0 },
-  { "i", 27, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm6lo", 28, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm6hi", 29, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm7lo", 30, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm7hi", 31, -1, 0, 0, 0, 0, 0, 0 },
-  { "z", 32, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm6", 33, -1, 0, 0, 0, 0, 0, 0 },
-  { "imm7", 34, -1, 0, 0, 0, 0, 0, 0 }
-};
-
-
-/* Iclass table.  */
-
-static xtensa_arg_internal Iclass_xt_iclass_rfe_stateArgs[] = {
-  { { STATE_PSEXCM }, 'o' },
-  { { STATE_EPC1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfde_stateArgs[] = {
-  { { STATE_DEPC }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call12_args[] = {
-  { { 0 /* soffsetx4 */ }, 'i' },
-  { { 10 /* ar12 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call12_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call8_args[] = {
-  { { 0 /* soffsetx4 */ }, 'i' },
-  { { 9 /* ar8 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call8_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call4_args[] = {
-  { { 0 /* soffsetx4 */ }, 'i' },
-  { { 8 /* ar4 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call4_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx12_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 10 /* ar12 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx12_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx8_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 9 /* ar8 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx8_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx4_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 8 /* ar4 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx4_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_entry_args[] = {
-  { { 11 /* ars_entry */ }, 's' },
-  { { 4 /* ars */ }, 'i' },
-  { { 1 /* uimm12x8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_entry_stateArgs[] = {
-  { { STATE_PSCALLINC }, 'i' },
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSWOE }, 'i' },
-  { { STATE_WindowBase }, 'm' },
-  { { STATE_WindowStart }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_movsp_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_movsp_stateArgs[] = {
-  { { STATE_WindowBase }, 'i' },
-  { { STATE_WindowStart }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rotw_args[] = {
-  { { 2 /* simm4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rotw_stateArgs[] = {
-  { { STATE_WindowBase }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_retw_args[] = {
-  { { 5 /* *ars_invisible */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_retw_stateArgs[] = {
-  { { STATE_WindowBase }, 'm' },
-  { { STATE_WindowStart }, 'm' },
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSWOE }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfwou_stateArgs[] = {
-  { { STATE_EPC1 }, 'i' },
-  { { STATE_PSEXCM }, 'o' },
-  { { STATE_WindowBase }, 'm' },
-  { { STATE_WindowStart }, 'm' },
-  { { STATE_PSOWB }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l32e_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 12 /* immrx4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_s32e_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' },
-  { { 12 /* immrx4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_windowbase_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_windowbase_stateArgs[] = {
-  { { STATE_WindowBase }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_windowbase_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_windowbase_stateArgs[] = {
-  { { STATE_WindowBase }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_windowbase_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_windowbase_stateArgs[] = {
-  { { STATE_WindowBase }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_windowstart_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_windowstart_stateArgs[] = {
-  { { STATE_WindowStart }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_windowstart_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_windowstart_stateArgs[] = {
-  { { STATE_WindowStart }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_windowstart_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_windowstart_stateArgs[] = {
-  { { STATE_WindowStart }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_add_n_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_addi_n_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 16 /* ai4const */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bz6_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 15 /* uimm6 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_loadi4_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 13 /* lsi4x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_mov_n_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_movi_n_args[] = {
-  { { 4 /* ars */ }, 'o' },
-  { { 14 /* simm7 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_retn_args[] = {
-  { { 5 /* *ars_invisible */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_storei4_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' },
-  { { 13 /* lsi4x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_addi_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 23 /* simm8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_addmi_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 24 /* simm8x256 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_addsub_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bit_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bsi8_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 17 /* b4const */ }, 'i' },
-  { { 28 /* label8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bsi8b_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 37 /* bbi */ }, 'i' },
-  { { 28 /* label8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bsi8u_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 18 /* b4constu */ }, 'i' },
-  { { 28 /* label8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bst8_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' },
-  { { 28 /* label8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_bsz12_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 30 /* label12 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_call0_args[] = {
-  { { 0 /* soffsetx4 */ }, 'i' },
-  { { 7 /* ar0 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_callx0_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 7 /* ar0 */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_exti_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 6 /* art */ }, 'i' },
-  { { 52 /* sae */ }, 'i' },
-  { { 27 /* op2p1 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_jump_args[] = {
-  { { 31 /* soffset */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_jumpx_args[] = {
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l16ui_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 20 /* uimm8x2 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l16si_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 20 /* uimm8x2 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l32i_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l32r_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 32 /* uimm16x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l32r_stateArgs[] = {
-  { { STATE_LITBADDR }, 'i' },
-  { { STATE_LITBEN }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_l8i_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 19 /* uimm8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_loop_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 29 /* ulabel8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_loop_stateArgs[] = {
-  { { STATE_LBEG }, 'o' },
-  { { STATE_LEND }, 'o' },
-  { { STATE_LCOUNT }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_loopz_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 29 /* ulabel8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_loopz_stateArgs[] = {
-  { { STATE_LBEG }, 'o' },
-  { { STATE_LEND }, 'o' },
-  { { STATE_LCOUNT }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_movi_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 25 /* simm12b */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_movz_args[] = {
-  { { 3 /* arr */ }, 'm' },
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_neg_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_return_args[] = {
-  { { 5 /* *ars_invisible */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_s16i_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' },
-  { { 20 /* uimm8x2 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_s32i_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_s8i_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' },
-  { { 19 /* uimm8 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sar_args[] = {
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sar_stateArgs[] = {
-  { { STATE_SAR }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sari_args[] = {
-  { { 56 /* sas */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sari_stateArgs[] = {
-  { { STATE_SAR }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shifts_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shifts_stateArgs[] = {
-  { { STATE_SAR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shiftst_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shiftst_stateArgs[] = {
-  { { STATE_SAR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shiftt_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_shiftt_stateArgs[] = {
-  { { STATE_SAR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_slli_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 4 /* ars */ }, 'i' },
-  { { 26 /* msalp32 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_srai_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 6 /* art */ }, 'i' },
-  { { 54 /* sargt */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_srli_args[] = {
-  { { 3 /* arr */ }, 'o' },
-  { { 6 /* art */ }, 'i' },
-  { { 40 /* s */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sync_stateArgs[] = {
-  { { STATE_XTSYNC }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsil_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 40 /* s */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsil_stateArgs[] = {
-  { { STATE_PSWOE }, 'i' },
-  { { STATE_PSCALLINC }, 'i' },
-  { { STATE_PSOWB }, 'i' },
-  { { STATE_PSUM }, 'i' },
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSINTLEVEL }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lend_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lend_stateArgs[] = {
-  { { STATE_LEND }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lend_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lend_stateArgs[] = {
-  { { STATE_LEND }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lend_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lend_stateArgs[] = {
-  { { STATE_LEND }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lcount_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lcount_stateArgs[] = {
-  { { STATE_LCOUNT }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lcount_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lcount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_LCOUNT }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lcount_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lcount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_LCOUNT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lbeg_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_lbeg_stateArgs[] = {
-  { { STATE_LBEG }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lbeg_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_lbeg_stateArgs[] = {
-  { { STATE_LBEG }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lbeg_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_lbeg_stateArgs[] = {
-  { { STATE_LBEG }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_sar_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_sar_stateArgs[] = {
-  { { STATE_SAR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_sar_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_sar_stateArgs[] = {
-  { { STATE_SAR }, 'o' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_sar_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_sar_stateArgs[] = {
-  { { STATE_SAR }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_litbase_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_litbase_stateArgs[] = {
-  { { STATE_LITBADDR }, 'i' },
-  { { STATE_LITBEN }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_litbase_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_litbase_stateArgs[] = {
-  { { STATE_LITBADDR }, 'o' },
-  { { STATE_LITBEN }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_litbase_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_litbase_stateArgs[] = {
-  { { STATE_LITBADDR }, 'm' },
-  { { STATE_LITBEN }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_176_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_208_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ps_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ps_stateArgs[] = {
-  { { STATE_PSWOE }, 'i' },
-  { { STATE_PSCALLINC }, 'i' },
-  { { STATE_PSOWB }, 'i' },
-  { { STATE_PSUM }, 'i' },
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSINTLEVEL }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ps_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ps_stateArgs[] = {
-  { { STATE_PSWOE }, 'o' },
-  { { STATE_PSCALLINC }, 'o' },
-  { { STATE_PSOWB }, 'o' },
-  { { STATE_PSUM }, 'o' },
-  { { STATE_PSEXCM }, 'o' },
-  { { STATE_PSINTLEVEL }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ps_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ps_stateArgs[] = {
-  { { STATE_PSWOE }, 'm' },
-  { { STATE_PSCALLINC }, 'm' },
-  { { STATE_PSOWB }, 'm' },
-  { { STATE_PSUM }, 'm' },
-  { { STATE_PSEXCM }, 'm' },
-  { { STATE_PSINTLEVEL }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc1_stateArgs[] = {
-  { { STATE_EPC1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc1_stateArgs[] = {
-  { { STATE_EPC1 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc1_stateArgs[] = {
-  { { STATE_EPC1 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave1_stateArgs[] = {
-  { { STATE_EXCSAVE1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave1_stateArgs[] = {
-  { { STATE_EXCSAVE1 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave1_stateArgs[] = {
-  { { STATE_EXCSAVE1 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc2_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc2_stateArgs[] = {
-  { { STATE_EPC2 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc2_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc2_stateArgs[] = {
-  { { STATE_EPC2 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc2_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc2_stateArgs[] = {
-  { { STATE_EPC2 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave2_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave2_stateArgs[] = {
-  { { STATE_EXCSAVE2 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave2_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave2_stateArgs[] = {
-  { { STATE_EXCSAVE2 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave2_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave2_stateArgs[] = {
-  { { STATE_EXCSAVE2 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc3_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc3_stateArgs[] = {
-  { { STATE_EPC3 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc3_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc3_stateArgs[] = {
-  { { STATE_EPC3 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc3_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc3_stateArgs[] = {
-  { { STATE_EPC3 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave3_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave3_stateArgs[] = {
-  { { STATE_EXCSAVE3 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave3_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave3_stateArgs[] = {
-  { { STATE_EXCSAVE3 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave3_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave3_stateArgs[] = {
-  { { STATE_EXCSAVE3 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc4_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_epc4_stateArgs[] = {
-  { { STATE_EPC4 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc4_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_epc4_stateArgs[] = {
-  { { STATE_EPC4 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc4_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_epc4_stateArgs[] = {
-  { { STATE_EPC4 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave4_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excsave4_stateArgs[] = {
-  { { STATE_EXCSAVE4 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave4_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excsave4_stateArgs[] = {
-  { { STATE_EXCSAVE4 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave4_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excsave4_stateArgs[] = {
-  { { STATE_EXCSAVE4 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps2_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps2_stateArgs[] = {
-  { { STATE_EPS2 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps2_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps2_stateArgs[] = {
-  { { STATE_EPS2 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps2_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps2_stateArgs[] = {
-  { { STATE_EPS2 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps3_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps3_stateArgs[] = {
-  { { STATE_EPS3 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps3_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps3_stateArgs[] = {
-  { { STATE_EPS3 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps3_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps3_stateArgs[] = {
-  { { STATE_EPS3 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps4_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_eps4_stateArgs[] = {
-  { { STATE_EPS4 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps4_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_eps4_stateArgs[] = {
-  { { STATE_EPS4 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps4_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_eps4_stateArgs[] = {
-  { { STATE_EPS4 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excvaddr_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_excvaddr_stateArgs[] = {
-  { { STATE_EXCVADDR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excvaddr_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_excvaddr_stateArgs[] = {
-  { { STATE_EXCVADDR }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excvaddr_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_excvaddr_stateArgs[] = {
-  { { STATE_EXCVADDR }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_depc_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_depc_stateArgs[] = {
-  { { STATE_DEPC }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_depc_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_depc_stateArgs[] = {
-  { { STATE_DEPC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_depc_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_depc_stateArgs[] = {
-  { { STATE_DEPC }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_exccause_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_exccause_stateArgs[] = {
-  { { STATE_EXCCAUSE }, 'i' },
-  { { STATE_XTSYNC }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_exccause_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_exccause_stateArgs[] = {
-  { { STATE_EXCCAUSE }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_exccause_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_exccause_stateArgs[] = {
-  { { STATE_EXCCAUSE }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_misc0_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_misc0_stateArgs[] = {
-  { { STATE_MISC0 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_misc0_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_misc0_stateArgs[] = {
-  { { STATE_MISC0 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_misc0_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_misc0_stateArgs[] = {
-  { { STATE_MISC0 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_misc1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_misc1_stateArgs[] = {
-  { { STATE_MISC1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_misc1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_misc1_stateArgs[] = {
-  { { STATE_MISC1 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_misc1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_misc1_stateArgs[] = {
-  { { STATE_MISC1 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_prid_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfi_args[] = {
-  { { 40 /* s */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfi_stateArgs[] = {
-  { { STATE_PSWOE }, 'o' },
-  { { STATE_PSCALLINC }, 'o' },
-  { { STATE_PSOWB }, 'o' },
-  { { STATE_PSUM }, 'o' },
-  { { STATE_PSEXCM }, 'o' },
-  { { STATE_PSINTLEVEL }, 'o' },
-  { { STATE_EPC1 }, 'i' },
-  { { STATE_EPC2 }, 'i' },
-  { { STATE_EPC3 }, 'i' },
-  { { STATE_EPC4 }, 'i' },
-  { { STATE_EPS2 }, 'i' },
-  { { STATE_EPS3 }, 'i' },
-  { { STATE_EPS4 }, 'i' },
-  { { STATE_InOCDMode }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wait_args[] = {
-  { { 40 /* s */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wait_stateArgs[] = {
-  { { STATE_PSINTLEVEL }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_interrupt_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_interrupt_stateArgs[] = {
-  { { STATE_INTERRUPT }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intset_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intset_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intclear_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intclear_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_intenable_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_intenable_stateArgs[] = {
-  { { STATE_INTENABLE }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intenable_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_intenable_stateArgs[] = {
-  { { STATE_INTENABLE }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_intenable_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_intenable_stateArgs[] = {
-  { { STATE_INTENABLE }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_break_args[] = {
-  { { 34 /* imms */ }, 'i' },
-  { { 33 /* immt */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_break_stateArgs[] = {
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSINTLEVEL }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_break_n_args[] = {
-  { { 34 /* imms */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_break_n_stateArgs[] = {
-  { { STATE_PSEXCM }, 'i' },
-  { { STATE_PSINTLEVEL }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreaka0_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreaka0_stateArgs[] = {
-  { { STATE_DBREAKA0 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreaka0_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreaka0_stateArgs[] = {
-  { { STATE_DBREAKA0 }, 'o' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreaka0_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreaka0_stateArgs[] = {
-  { { STATE_DBREAKA0 }, 'm' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreakc0_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreakc0_stateArgs[] = {
-  { { STATE_DBREAKC0 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreakc0_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreakc0_stateArgs[] = {
-  { { STATE_DBREAKC0 }, 'o' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreakc0_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreakc0_stateArgs[] = {
-  { { STATE_DBREAKC0 }, 'm' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreaka1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreaka1_stateArgs[] = {
-  { { STATE_DBREAKA1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreaka1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreaka1_stateArgs[] = {
-  { { STATE_DBREAKA1 }, 'o' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreaka1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreaka1_stateArgs[] = {
-  { { STATE_DBREAKA1 }, 'm' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreakc1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_dbreakc1_stateArgs[] = {
-  { { STATE_DBREAKC1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreakc1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_dbreakc1_stateArgs[] = {
-  { { STATE_DBREAKC1 }, 'o' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreakc1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_dbreakc1_stateArgs[] = {
-  { { STATE_DBREAKC1 }, 'm' },
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreaka0_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreaka0_stateArgs[] = {
-  { { STATE_IBREAKA0 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreaka0_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreaka0_stateArgs[] = {
-  { { STATE_IBREAKA0 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreaka0_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreaka0_stateArgs[] = {
-  { { STATE_IBREAKA0 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreaka1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreaka1_stateArgs[] = {
-  { { STATE_IBREAKA1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreaka1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreaka1_stateArgs[] = {
-  { { STATE_IBREAKA1 }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreaka1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreaka1_stateArgs[] = {
-  { { STATE_IBREAKA1 }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreakenable_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ibreakenable_stateArgs[] = {
-  { { STATE_IBREAKENABLE }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreakenable_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ibreakenable_stateArgs[] = {
-  { { STATE_IBREAKENABLE }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreakenable_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ibreakenable_stateArgs[] = {
-  { { STATE_IBREAKENABLE }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_debugcause_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_debugcause_stateArgs[] = {
-  { { STATE_DEBUGCAUSE }, 'i' },
-  { { STATE_DBNUM }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_debugcause_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_debugcause_stateArgs[] = {
-  { { STATE_DEBUGCAUSE }, 'o' },
-  { { STATE_DBNUM }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_debugcause_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_debugcause_stateArgs[] = {
-  { { STATE_DEBUGCAUSE }, 'm' },
-  { { STATE_DBNUM }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_icount_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_icount_stateArgs[] = {
-  { { STATE_ICOUNT }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_icount_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_icount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_ICOUNT }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_icount_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_icount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_ICOUNT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_icountlevel_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_icountlevel_stateArgs[] = {
-  { { STATE_ICOUNTLEVEL }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_icountlevel_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_icountlevel_stateArgs[] = {
-  { { STATE_ICOUNTLEVEL }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_icountlevel_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_icountlevel_stateArgs[] = {
-  { { STATE_ICOUNTLEVEL }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ddr_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ddr_stateArgs[] = {
-  { { STATE_DDR }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ddr_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ddr_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_DDR }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ddr_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ddr_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_DDR }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfdo_stateArgs[] = {
-  { { STATE_InOCDMode }, 'm' },
-  { { STATE_EPC4 }, 'i' },
-  { { STATE_PSWOE }, 'o' },
-  { { STATE_PSCALLINC }, 'o' },
-  { { STATE_PSOWB }, 'o' },
-  { { STATE_PSUM }, 'o' },
-  { { STATE_PSEXCM }, 'o' },
-  { { STATE_PSINTLEVEL }, 'o' },
-  { { STATE_EPS4 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rfdd_stateArgs[] = {
-  { { STATE_InOCDMode }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccount_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccount_stateArgs[] = {
-  { { STATE_CCOUNT }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccount_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_CCOUNT }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccount_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccount_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' },
-  { { STATE_CCOUNT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare0_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare0_stateArgs[] = {
-  { { STATE_CCOMPARE0 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare0_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare0_stateArgs[] = {
-  { { STATE_CCOMPARE0 }, 'o' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare0_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare0_stateArgs[] = {
-  { { STATE_CCOMPARE0 }, 'm' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare1_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare1_stateArgs[] = {
-  { { STATE_CCOMPARE1 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare1_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare1_stateArgs[] = {
-  { { STATE_CCOMPARE1 }, 'o' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare1_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare1_stateArgs[] = {
-  { { STATE_CCOMPARE1 }, 'm' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare2_args[] = {
-  { { 6 /* art */ }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rsr_ccompare2_stateArgs[] = {
-  { { STATE_CCOMPARE2 }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare2_args[] = {
-  { { 6 /* art */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wsr_ccompare2_stateArgs[] = {
-  { { STATE_CCOMPARE2 }, 'o' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare2_args[] = {
-  { { 6 /* art */ }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_xsr_ccompare2_stateArgs[] = {
-  { { STATE_CCOMPARE2 }, 'm' },
-  { { STATE_INTERRUPT }, 'm' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_icache_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_icache_inv_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_licx_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sicx_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_dcache_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_dcache_ind_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 22 /* uimm4x16 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_dcache_inv_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_dpf_args[] = {
-  { { 4 /* ars */ }, 'i' },
-  { { 21 /* uimm8x4 */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_sdct_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_ldct_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_idtlb_args[] = {
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_idtlb_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_rdtlb_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wdtlb_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_wdtlb_stateArgs[] = {
-  { { STATE_XTSYNC }, 'o' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_iitlb_args[] = {
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_ritlb_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_witlb_args[] = {
-  { { 6 /* art */ }, 'i' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_arg_internal Iclass_xt_iclass_nsa_args[] = {
-  { { 6 /* art */ }, 'o' },
-  { { 4 /* ars */ }, 'i' }
-};
-
-static xtensa_iclass_internal iclasses[] = {
-  { 0, 0 /* xt_iclass_excw */,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_rfe */,
-    2, Iclass_xt_iclass_rfe_stateArgs, 0, 0 },
-  { 0, 0 /* xt_iclass_rfde */,
-    1, Iclass_xt_iclass_rfde_stateArgs, 0, 0 },
-  { 0, 0 /* xt_iclass_syscall */,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_simcall */,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_call12_args,
-    1, Iclass_xt_iclass_call12_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_call8_args,
-    1, Iclass_xt_iclass_call8_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_call4_args,
-    1, Iclass_xt_iclass_call4_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_callx12_args,
-    1, Iclass_xt_iclass_callx12_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_callx8_args,
-    1, Iclass_xt_iclass_callx8_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_callx4_args,
-    1, Iclass_xt_iclass_callx4_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_entry_args,
-    5, Iclass_xt_iclass_entry_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_movsp_args,
-    2, Iclass_xt_iclass_movsp_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rotw_args,
-    1, Iclass_xt_iclass_rotw_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_retw_args,
-    4, Iclass_xt_iclass_retw_stateArgs, 0, 0 },
-  { 0, 0 /* xt_iclass_rfwou */,
-    5, Iclass_xt_iclass_rfwou_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_l32e_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_s32e_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_windowbase_args,
-    1, Iclass_xt_iclass_rsr_windowbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_windowbase_args,
-    1, Iclass_xt_iclass_wsr_windowbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_windowbase_args,
-    1, Iclass_xt_iclass_xsr_windowbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_windowstart_args,
-    1, Iclass_xt_iclass_rsr_windowstart_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_windowstart_args,
-    1, Iclass_xt_iclass_wsr_windowstart_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_windowstart_args,
-    1, Iclass_xt_iclass_xsr_windowstart_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_add_n_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_addi_n_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_bz6_args,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_ill_n */,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_loadi4_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_mov_n_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_movi_n_args,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_nopn */,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_retn_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_storei4_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_addi_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_addmi_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_addsub_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_bit_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_bsi8_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_bsi8b_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_bsi8u_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_bst8_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_bsz12_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_call0_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_callx0_args,
-    0, 0, 0, 0 },
-  { 4, Iclass_xt_iclass_exti_args,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_ill */,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_jump_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_jumpx_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_l16ui_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_l16si_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_l32i_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_l32r_args,
-    2, Iclass_xt_iclass_l32r_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_l8i_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_loop_args,
-    3, Iclass_xt_iclass_loop_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_loopz_args,
-    3, Iclass_xt_iclass_loopz_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_movi_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_movz_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_neg_args,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_nop */,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_return_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_s16i_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_s32i_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_s8i_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_sar_args,
-    1, Iclass_xt_iclass_sar_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_sari_args,
-    1, Iclass_xt_iclass_sari_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_shifts_args,
-    1, Iclass_xt_iclass_shifts_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_shiftst_args,
-    1, Iclass_xt_iclass_shiftst_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_shiftt_args,
-    1, Iclass_xt_iclass_shiftt_stateArgs, 0, 0 },
-  { 3, Iclass_xt_iclass_slli_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_srai_args,
-    0, 0, 0, 0 },
-  { 3, Iclass_xt_iclass_srli_args,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_memw */,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_extw */,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_isync */,
-    0, 0, 0, 0 },
-  { 0, 0 /* xt_iclass_sync */,
-    1, Iclass_xt_iclass_sync_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_rsil_args,
-    6, Iclass_xt_iclass_rsil_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_lend_args,
-    1, Iclass_xt_iclass_rsr_lend_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_lend_args,
-    1, Iclass_xt_iclass_wsr_lend_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_lend_args,
-    1, Iclass_xt_iclass_xsr_lend_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_lcount_args,
-    1, Iclass_xt_iclass_rsr_lcount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_lcount_args,
-    2, Iclass_xt_iclass_wsr_lcount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_lcount_args,
-    2, Iclass_xt_iclass_xsr_lcount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_lbeg_args,
-    1, Iclass_xt_iclass_rsr_lbeg_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_lbeg_args,
-    1, Iclass_xt_iclass_wsr_lbeg_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_lbeg_args,
-    1, Iclass_xt_iclass_xsr_lbeg_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_sar_args,
-    1, Iclass_xt_iclass_rsr_sar_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_sar_args,
-    2, Iclass_xt_iclass_wsr_sar_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_sar_args,
-    1, Iclass_xt_iclass_xsr_sar_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_litbase_args,
-    2, Iclass_xt_iclass_rsr_litbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_litbase_args,
-    2, Iclass_xt_iclass_wsr_litbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_litbase_args,
-    2, Iclass_xt_iclass_xsr_litbase_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_176_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_208_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ps_args,
-    6, Iclass_xt_iclass_rsr_ps_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ps_args,
-    6, Iclass_xt_iclass_wsr_ps_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ps_args,
-    6, Iclass_xt_iclass_xsr_ps_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_epc1_args,
-    1, Iclass_xt_iclass_rsr_epc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_epc1_args,
-    1, Iclass_xt_iclass_wsr_epc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_epc1_args,
-    1, Iclass_xt_iclass_xsr_epc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_excsave1_args,
-    1, Iclass_xt_iclass_rsr_excsave1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_excsave1_args,
-    1, Iclass_xt_iclass_wsr_excsave1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_excsave1_args,
-    1, Iclass_xt_iclass_xsr_excsave1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_epc2_args,
-    1, Iclass_xt_iclass_rsr_epc2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_epc2_args,
-    1, Iclass_xt_iclass_wsr_epc2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_epc2_args,
-    1, Iclass_xt_iclass_xsr_epc2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_excsave2_args,
-    1, Iclass_xt_iclass_rsr_excsave2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_excsave2_args,
-    1, Iclass_xt_iclass_wsr_excsave2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_excsave2_args,
-    1, Iclass_xt_iclass_xsr_excsave2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_epc3_args,
-    1, Iclass_xt_iclass_rsr_epc3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_epc3_args,
-    1, Iclass_xt_iclass_wsr_epc3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_epc3_args,
-    1, Iclass_xt_iclass_xsr_epc3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_excsave3_args,
-    1, Iclass_xt_iclass_rsr_excsave3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_excsave3_args,
-    1, Iclass_xt_iclass_wsr_excsave3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_excsave3_args,
-    1, Iclass_xt_iclass_xsr_excsave3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_epc4_args,
-    1, Iclass_xt_iclass_rsr_epc4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_epc4_args,
-    1, Iclass_xt_iclass_wsr_epc4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_epc4_args,
-    1, Iclass_xt_iclass_xsr_epc4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_excsave4_args,
-    1, Iclass_xt_iclass_rsr_excsave4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_excsave4_args,
-    1, Iclass_xt_iclass_wsr_excsave4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_excsave4_args,
-    1, Iclass_xt_iclass_xsr_excsave4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_eps2_args,
-    1, Iclass_xt_iclass_rsr_eps2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_eps2_args,
-    1, Iclass_xt_iclass_wsr_eps2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_eps2_args,
-    1, Iclass_xt_iclass_xsr_eps2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_eps3_args,
-    1, Iclass_xt_iclass_rsr_eps3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_eps3_args,
-    1, Iclass_xt_iclass_wsr_eps3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_eps3_args,
-    1, Iclass_xt_iclass_xsr_eps3_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_eps4_args,
-    1, Iclass_xt_iclass_rsr_eps4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_eps4_args,
-    1, Iclass_xt_iclass_wsr_eps4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_eps4_args,
-    1, Iclass_xt_iclass_xsr_eps4_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_excvaddr_args,
-    1, Iclass_xt_iclass_rsr_excvaddr_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_excvaddr_args,
-    1, Iclass_xt_iclass_wsr_excvaddr_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_excvaddr_args,
-    1, Iclass_xt_iclass_xsr_excvaddr_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_depc_args,
-    1, Iclass_xt_iclass_rsr_depc_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_depc_args,
-    1, Iclass_xt_iclass_wsr_depc_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_depc_args,
-    1, Iclass_xt_iclass_xsr_depc_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_exccause_args,
-    2, Iclass_xt_iclass_rsr_exccause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_exccause_args,
-    1, Iclass_xt_iclass_wsr_exccause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_exccause_args,
-    1, Iclass_xt_iclass_xsr_exccause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_misc0_args,
-    1, Iclass_xt_iclass_rsr_misc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_misc0_args,
-    1, Iclass_xt_iclass_wsr_misc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_misc0_args,
-    1, Iclass_xt_iclass_xsr_misc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_misc1_args,
-    1, Iclass_xt_iclass_rsr_misc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_misc1_args,
-    1, Iclass_xt_iclass_wsr_misc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_misc1_args,
-    1, Iclass_xt_iclass_xsr_misc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_prid_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_rfi_args,
-    14, Iclass_xt_iclass_rfi_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wait_args,
-    1, Iclass_xt_iclass_wait_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_interrupt_args,
-    1, Iclass_xt_iclass_rsr_interrupt_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_intset_args,
-    2, Iclass_xt_iclass_wsr_intset_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_intclear_args,
-    2, Iclass_xt_iclass_wsr_intclear_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_intenable_args,
-    1, Iclass_xt_iclass_rsr_intenable_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_intenable_args,
-    1, Iclass_xt_iclass_wsr_intenable_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_intenable_args,
-    1, Iclass_xt_iclass_xsr_intenable_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_break_args,
-    2, Iclass_xt_iclass_break_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_break_n_args,
-    2, Iclass_xt_iclass_break_n_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_dbreaka0_args,
-    1, Iclass_xt_iclass_rsr_dbreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_dbreaka0_args,
-    2, Iclass_xt_iclass_wsr_dbreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_dbreaka0_args,
-    2, Iclass_xt_iclass_xsr_dbreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_dbreakc0_args,
-    1, Iclass_xt_iclass_rsr_dbreakc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_dbreakc0_args,
-    2, Iclass_xt_iclass_wsr_dbreakc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_dbreakc0_args,
-    2, Iclass_xt_iclass_xsr_dbreakc0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_dbreaka1_args,
-    1, Iclass_xt_iclass_rsr_dbreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_dbreaka1_args,
-    2, Iclass_xt_iclass_wsr_dbreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_dbreaka1_args,
-    2, Iclass_xt_iclass_xsr_dbreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_dbreakc1_args,
-    1, Iclass_xt_iclass_rsr_dbreakc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_dbreakc1_args,
-    2, Iclass_xt_iclass_wsr_dbreakc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_dbreakc1_args,
-    2, Iclass_xt_iclass_xsr_dbreakc1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ibreaka0_args,
-    1, Iclass_xt_iclass_rsr_ibreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ibreaka0_args,
-    1, Iclass_xt_iclass_wsr_ibreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ibreaka0_args,
-    1, Iclass_xt_iclass_xsr_ibreaka0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ibreaka1_args,
-    1, Iclass_xt_iclass_rsr_ibreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ibreaka1_args,
-    1, Iclass_xt_iclass_wsr_ibreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ibreaka1_args,
-    1, Iclass_xt_iclass_xsr_ibreaka1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ibreakenable_args,
-    1, Iclass_xt_iclass_rsr_ibreakenable_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ibreakenable_args,
-    1, Iclass_xt_iclass_wsr_ibreakenable_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ibreakenable_args,
-    1, Iclass_xt_iclass_xsr_ibreakenable_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_debugcause_args,
-    2, Iclass_xt_iclass_rsr_debugcause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_debugcause_args,
-    2, Iclass_xt_iclass_wsr_debugcause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_debugcause_args,
-    2, Iclass_xt_iclass_xsr_debugcause_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_icount_args,
-    1, Iclass_xt_iclass_rsr_icount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_icount_args,
-    2, Iclass_xt_iclass_wsr_icount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_icount_args,
-    2, Iclass_xt_iclass_xsr_icount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_icountlevel_args,
-    1, Iclass_xt_iclass_rsr_icountlevel_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_icountlevel_args,
-    1, Iclass_xt_iclass_wsr_icountlevel_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_icountlevel_args,
-    1, Iclass_xt_iclass_xsr_icountlevel_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ddr_args,
-    1, Iclass_xt_iclass_rsr_ddr_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ddr_args,
-    2, Iclass_xt_iclass_wsr_ddr_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ddr_args,
-    2, Iclass_xt_iclass_xsr_ddr_stateArgs, 0, 0 },
-  { 0, 0 /* xt_iclass_rfdo */,
-    9, Iclass_xt_iclass_rfdo_stateArgs, 0, 0 },
-  { 0, 0 /* xt_iclass_rfdd */,
-    1, Iclass_xt_iclass_rfdd_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ccount_args,
-    1, Iclass_xt_iclass_rsr_ccount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ccount_args,
-    2, Iclass_xt_iclass_wsr_ccount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ccount_args,
-    2, Iclass_xt_iclass_xsr_ccount_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ccompare0_args,
-    1, Iclass_xt_iclass_rsr_ccompare0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ccompare0_args,
-    2, Iclass_xt_iclass_wsr_ccompare0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ccompare0_args,
-    2, Iclass_xt_iclass_xsr_ccompare0_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ccompare1_args,
-    1, Iclass_xt_iclass_rsr_ccompare1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ccompare1_args,
-    2, Iclass_xt_iclass_wsr_ccompare1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ccompare1_args,
-    2, Iclass_xt_iclass_xsr_ccompare1_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_rsr_ccompare2_args,
-    1, Iclass_xt_iclass_rsr_ccompare2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_wsr_ccompare2_args,
-    2, Iclass_xt_iclass_wsr_ccompare2_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_xsr_ccompare2_args,
-    2, Iclass_xt_iclass_xsr_ccompare2_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_icache_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_icache_inv_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_licx_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_sicx_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_dcache_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_dcache_ind_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_dcache_inv_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_dpf_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_sdct_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_ldct_args,
-    0, 0, 0, 0 },
-  { 1, Iclass_xt_iclass_idtlb_args,
-    1, Iclass_xt_iclass_idtlb_stateArgs, 0, 0 },
-  { 2, Iclass_xt_iclass_rdtlb_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_wdtlb_args,
-    1, Iclass_xt_iclass_wdtlb_stateArgs, 0, 0 },
-  { 1, Iclass_xt_iclass_iitlb_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_ritlb_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_witlb_args,
-    0, 0, 0, 0 },
-  { 2, Iclass_xt_iclass_nsa_args,
-    0, 0, 0, 0 }
-};
-
-
-/*  Opcode encodings.  */
-
-static void
-Opcode_excw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x80200;
-}
-
-static void
-Opcode_rfe_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x300;
-}
-
-static void
-Opcode_rfde_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x2300;
-}
-
-static void
-Opcode_syscall_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x500;
-}
-
-static void
-Opcode_simcall_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1500;
-}
-
-static void
-Opcode_call12_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x5c0000;
-}
-
-static void
-Opcode_call8_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x580000;
-}
-
-static void
-Opcode_call4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x540000;
-}
-
-static void
-Opcode_callx12_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf0000;
-}
-
-static void
-Opcode_callx8_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb0000;
-}
-
-static void
-Opcode_callx4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x70000;
-}
-
-static void
-Opcode_entry_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6c0000;
-}
-
-static void
-Opcode_movsp_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x100;
-}
-
-static void
-Opcode_rotw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x804;
-}
-
-static void
-Opcode_retw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x60000;
-}
-
-static void
-Opcode_retw_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd10f;
-}
-
-static void
-Opcode_rfwo_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4300;
-}
-
-static void
-Opcode_rfwu_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x5300;
-}
-
-static void
-Opcode_l32e_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x90;
-}
-
-static void
-Opcode_s32e_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x94;
-}
-
-static void
-Opcode_rsr_windowbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4830;
-}
-
-static void
-Opcode_wsr_windowbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4831;
-}
-
-static void
-Opcode_xsr_windowbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4816;
-}
-
-static void
-Opcode_rsr_windowstart_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4930;
-}
-
-static void
-Opcode_wsr_windowstart_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4931;
-}
-
-static void
-Opcode_xsr_windowstart_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4916;
-}
-
-static void
-Opcode_add_n_Slot_inst16a_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa000;
-}
-
-static void
-Opcode_addi_n_Slot_inst16a_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb000;
-}
-
-static void
-Opcode_beqz_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc800;
-}
-
-static void
-Opcode_bnez_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xcc00;
-}
-
-static void
-Opcode_ill_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd60f;
-}
-
-static void
-Opcode_l32i_n_Slot_inst16a_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8000;
-}
-
-static void
-Opcode_mov_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd000;
-}
-
-static void
-Opcode_movi_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc000;
-}
-
-static void
-Opcode_nop_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd30f;
-}
-
-static void
-Opcode_ret_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd00f;
-}
-
-static void
-Opcode_s32i_n_Slot_inst16a_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9000;
-}
-
-static void
-Opcode_addi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200c00;
-}
-
-static void
-Opcode_addmi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200d00;
-}
-
-static void
-Opcode_add_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8;
-}
-
-static void
-Opcode_sub_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc;
-}
-
-static void
-Opcode_addx2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9;
-}
-
-static void
-Opcode_addx4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa;
-}
-
-static void
-Opcode_addx8_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb;
-}
-
-static void
-Opcode_subx2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd;
-}
-
-static void
-Opcode_subx4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe;
-}
-
-static void
-Opcode_subx8_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf;
-}
-
-static void
-Opcode_and_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1;
-}
-
-static void
-Opcode_or_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x2;
-}
-
-static void
-Opcode_xor_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x3;
-}
-
-static void
-Opcode_beqi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x680000;
-}
-
-static void
-Opcode_bnei_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x690000;
-}
-
-static void
-Opcode_bgei_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6b0000;
-}
-
-static void
-Opcode_blti_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6a0000;
-}
-
-static void
-Opcode_bbci_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700600;
-}
-
-static void
-Opcode_bbsi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700e00;
-}
-
-static void
-Opcode_bgeui_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6f0000;
-}
-
-static void
-Opcode_bltui_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6e0000;
-}
-
-static void
-Opcode_beq_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700100;
-}
-
-static void
-Opcode_bne_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700900;
-}
-
-static void
-Opcode_bge_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700a00;
-}
-
-static void
-Opcode_blt_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700200;
-}
-
-static void
-Opcode_bgeu_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700b00;
-}
-
-static void
-Opcode_bltu_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700300;
-}
-
-static void
-Opcode_bany_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700800;
-}
-
-static void
-Opcode_bnone_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700000;
-}
-
-static void
-Opcode_ball_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700400;
-}
-
-static void
-Opcode_bnall_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700c00;
-}
-
-static void
-Opcode_bbc_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700500;
-}
-
-static void
-Opcode_bbs_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700d00;
-}
-
-static void
-Opcode_beqz_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x640000;
-}
-
-static void
-Opcode_bnez_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x650000;
-}
-
-static void
-Opcode_bgez_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x670000;
-}
-
-static void
-Opcode_bltz_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x660000;
-}
-
-static void
-Opcode_call0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x500000;
-}
-
-static void
-Opcode_callx0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x30000;
-}
-
-static void
-Opcode_extui_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x40;
-}
-
-static void
-Opcode_ill_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0;
-}
-
-static void
-Opcode_j_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x600000;
-}
-
-static void
-Opcode_jx_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa0000;
-}
-
-static void
-Opcode_l16ui_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200100;
-}
-
-static void
-Opcode_l16si_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200900;
-}
-
-static void
-Opcode_l32i_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200200;
-}
-
-static void
-Opcode_l32r_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x100000;
-}
-
-static void
-Opcode_l8ui_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200000;
-}
-
-static void
-Opcode_loop_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6d0800;
-}
-
-static void
-Opcode_loopnez_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6d0900;
-}
-
-static void
-Opcode_loopgtz_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6d0a00;
-}
-
-static void
-Opcode_movi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200a00;
-}
-
-static void
-Opcode_moveqz_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x38;
-}
-
-static void
-Opcode_movnez_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x39;
-}
-
-static void
-Opcode_movltz_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x3a;
-}
-
-static void
-Opcode_movgez_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x3b;
-}
-
-static void
-Opcode_neg_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6;
-}
-
-static void
-Opcode_abs_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1006;
-}
-
-static void
-Opcode_nop_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf0200;
-}
-
-static void
-Opcode_ret_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x20000;
-}
-
-static void
-Opcode_s16i_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200500;
-}
-
-static void
-Opcode_s32i_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200600;
-}
-
-static void
-Opcode_s8i_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200400;
-}
-
-static void
-Opcode_ssr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x4;
-}
-
-static void
-Opcode_ssl_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x104;
-}
-
-static void
-Opcode_ssa8l_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x204;
-}
-
-static void
-Opcode_ssa8b_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x304;
-}
-
-static void
-Opcode_ssai_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x404;
-}
-
-static void
-Opcode_sll_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1a;
-}
-
-static void
-Opcode_src_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x18;
-}
-
-static void
-Opcode_srl_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x19;
-}
-
-static void
-Opcode_sra_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1b;
-}
-
-static void
-Opcode_slli_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x10;
-}
-
-static void
-Opcode_srai_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x12;
-}
-
-static void
-Opcode_srli_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x14;
-}
-
-static void
-Opcode_memw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc0200;
-}
-
-static void
-Opcode_extw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd0200;
-}
-
-static void
-Opcode_isync_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200;
-}
-
-static void
-Opcode_rsync_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x10200;
-}
-
-static void
-Opcode_esync_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x20200;
-}
-
-static void
-Opcode_dsync_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x30200;
-}
-
-static void
-Opcode_rsil_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x600;
-}
-
-static void
-Opcode_rsr_lend_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x130;
-}
-
-static void
-Opcode_wsr_lend_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x131;
-}
-
-static void
-Opcode_xsr_lend_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x116;
-}
-
-static void
-Opcode_rsr_lcount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x230;
-}
-
-static void
-Opcode_wsr_lcount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x231;
-}
-
-static void
-Opcode_xsr_lcount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x216;
-}
-
-static void
-Opcode_rsr_lbeg_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x30;
-}
-
-static void
-Opcode_wsr_lbeg_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x31;
-}
-
-static void
-Opcode_xsr_lbeg_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x16;
-}
-
-static void
-Opcode_rsr_sar_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x330;
-}
-
-static void
-Opcode_wsr_sar_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x331;
-}
-
-static void
-Opcode_xsr_sar_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x316;
-}
-
-static void
-Opcode_rsr_litbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x530;
-}
-
-static void
-Opcode_wsr_litbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x531;
-}
-
-static void
-Opcode_xsr_litbase_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x516;
-}
-
-static void
-Opcode_rsr_176_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb030;
-}
-
-static void
-Opcode_rsr_208_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd030;
-}
-
-static void
-Opcode_rsr_ps_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe630;
-}
-
-static void
-Opcode_wsr_ps_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe631;
-}
-
-static void
-Opcode_xsr_ps_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe616;
-}
-
-static void
-Opcode_rsr_epc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb130;
-}
-
-static void
-Opcode_wsr_epc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb131;
-}
-
-static void
-Opcode_xsr_epc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb116;
-}
-
-static void
-Opcode_rsr_excsave1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd130;
-}
-
-static void
-Opcode_wsr_excsave1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd131;
-}
-
-static void
-Opcode_xsr_excsave1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd116;
-}
-
-static void
-Opcode_rsr_epc2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb230;
-}
-
-static void
-Opcode_wsr_epc2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb231;
-}
-
-static void
-Opcode_xsr_epc2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb216;
-}
-
-static void
-Opcode_rsr_excsave2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd230;
-}
-
-static void
-Opcode_wsr_excsave2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd231;
-}
-
-static void
-Opcode_xsr_excsave2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd216;
-}
-
-static void
-Opcode_rsr_epc3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb330;
-}
-
-static void
-Opcode_wsr_epc3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb331;
-}
-
-static void
-Opcode_xsr_epc3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb316;
-}
-
-static void
-Opcode_rsr_excsave3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd330;
-}
-
-static void
-Opcode_wsr_excsave3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd331;
-}
-
-static void
-Opcode_xsr_excsave3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd316;
-}
-
-static void
-Opcode_rsr_epc4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb430;
-}
-
-static void
-Opcode_wsr_epc4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb431;
-}
-
-static void
-Opcode_xsr_epc4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb416;
-}
-
-static void
-Opcode_rsr_excsave4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd430;
-}
-
-static void
-Opcode_wsr_excsave4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd431;
-}
-
-static void
-Opcode_xsr_excsave4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd416;
-}
-
-static void
-Opcode_rsr_eps2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc230;
-}
-
-static void
-Opcode_wsr_eps2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc231;
-}
-
-static void
-Opcode_xsr_eps2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc216;
-}
-
-static void
-Opcode_rsr_eps3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc330;
-}
-
-static void
-Opcode_wsr_eps3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc331;
-}
-
-static void
-Opcode_xsr_eps3_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc316;
-}
-
-static void
-Opcode_rsr_eps4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc430;
-}
-
-static void
-Opcode_wsr_eps4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc431;
-}
-
-static void
-Opcode_xsr_eps4_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc416;
-}
-
-static void
-Opcode_rsr_excvaddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xee30;
-}
-
-static void
-Opcode_wsr_excvaddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xee31;
-}
-
-static void
-Opcode_xsr_excvaddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xee16;
-}
-
-static void
-Opcode_rsr_depc_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc030;
-}
-
-static void
-Opcode_wsr_depc_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc031;
-}
-
-static void
-Opcode_xsr_depc_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc016;
-}
-
-static void
-Opcode_rsr_exccause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe830;
-}
-
-static void
-Opcode_wsr_exccause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe831;
-}
-
-static void
-Opcode_xsr_exccause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe816;
-}
-
-static void
-Opcode_rsr_misc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf430;
-}
-
-static void
-Opcode_wsr_misc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf431;
-}
-
-static void
-Opcode_xsr_misc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf416;
-}
-
-static void
-Opcode_rsr_misc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf530;
-}
-
-static void
-Opcode_wsr_misc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf531;
-}
-
-static void
-Opcode_xsr_misc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf516;
-}
-
-static void
-Opcode_rsr_prid_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xeb30;
-}
-
-static void
-Opcode_rfi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x10300;
-}
-
-static void
-Opcode_waiti_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x700;
-}
-
-static void
-Opcode_rsr_interrupt_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe230;
-}
-
-static void
-Opcode_wsr_intset_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe231;
-}
-
-static void
-Opcode_wsr_intclear_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe331;
-}
-
-static void
-Opcode_rsr_intenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe430;
-}
-
-static void
-Opcode_wsr_intenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe431;
-}
-
-static void
-Opcode_xsr_intenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe416;
-}
-
-static void
-Opcode_break_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x400;
-}
-
-static void
-Opcode_break_n_Slot_inst16b_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd20f;
-}
-
-static void
-Opcode_rsr_dbreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9030;
-}
-
-static void
-Opcode_wsr_dbreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9031;
-}
-
-static void
-Opcode_xsr_dbreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9016;
-}
-
-static void
-Opcode_rsr_dbreakc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa030;
-}
-
-static void
-Opcode_wsr_dbreakc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa031;
-}
-
-static void
-Opcode_xsr_dbreakc0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa016;
-}
-
-static void
-Opcode_rsr_dbreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9130;
-}
-
-static void
-Opcode_wsr_dbreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9131;
-}
-
-static void
-Opcode_xsr_dbreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x9116;
-}
-
-static void
-Opcode_rsr_dbreakc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa130;
-}
-
-static void
-Opcode_wsr_dbreakc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa131;
-}
-
-static void
-Opcode_xsr_dbreakc1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xa116;
-}
-
-static void
-Opcode_rsr_ibreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8030;
-}
-
-static void
-Opcode_wsr_ibreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8031;
-}
-
-static void
-Opcode_xsr_ibreaka0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8016;
-}
-
-static void
-Opcode_rsr_ibreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8130;
-}
-
-static void
-Opcode_wsr_ibreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8131;
-}
-
-static void
-Opcode_xsr_ibreaka1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x8116;
-}
-
-static void
-Opcode_rsr_ibreakenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6030;
-}
-
-static void
-Opcode_wsr_ibreakenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6031;
-}
-
-static void
-Opcode_xsr_ibreakenable_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6016;
-}
-
-static void
-Opcode_rsr_debugcause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe930;
-}
-
-static void
-Opcode_wsr_debugcause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe931;
-}
-
-static void
-Opcode_xsr_debugcause_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe916;
-}
-
-static void
-Opcode_rsr_icount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xec30;
-}
-
-static void
-Opcode_wsr_icount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xec31;
-}
-
-static void
-Opcode_xsr_icount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xec16;
-}
-
-static void
-Opcode_rsr_icountlevel_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xed30;
-}
-
-static void
-Opcode_wsr_icountlevel_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xed31;
-}
-
-static void
-Opcode_xsr_icountlevel_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xed16;
-}
-
-static void
-Opcode_rsr_ddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6830;
-}
-
-static void
-Opcode_wsr_ddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6831;
-}
-
-static void
-Opcode_xsr_ddr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x6816;
-}
-
-static void
-Opcode_rfdo_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe1f;
-}
-
-static void
-Opcode_rfdd_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x10e1f;
-}
-
-static void
-Opcode_rsr_ccount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xea30;
-}
-
-static void
-Opcode_wsr_ccount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xea31;
-}
-
-static void
-Opcode_xsr_ccount_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xea16;
-}
-
-static void
-Opcode_rsr_ccompare0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf030;
-}
-
-static void
-Opcode_wsr_ccompare0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf031;
-}
-
-static void
-Opcode_xsr_ccompare0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf016;
-}
-
-static void
-Opcode_rsr_ccompare1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf130;
-}
-
-static void
-Opcode_wsr_ccompare1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf131;
-}
-
-static void
-Opcode_xsr_ccompare1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf116;
-}
-
-static void
-Opcode_rsr_ccompare2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf230;
-}
-
-static void
-Opcode_wsr_ccompare2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf231;
-}
-
-static void
-Opcode_xsr_ccompare2_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf216;
-}
-
-static void
-Opcode_ipf_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x2c0700;
-}
-
-static void
-Opcode_ihi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x2e0700;
-}
-
-static void
-Opcode_iii_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x2f0700;
-}
-
-static void
-Opcode_lict_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x1f;
-}
-
-static void
-Opcode_licw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x21f;
-}
-
-static void
-Opcode_sict_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x11f;
-}
-
-static void
-Opcode_sicw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x31f;
-}
-
-static void
-Opcode_dhwb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x240700;
-}
-
-static void
-Opcode_dhwbi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x250700;
-}
-
-static void
-Opcode_diwb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x280740;
-}
-
-static void
-Opcode_diwbi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x280750;
-}
-
-static void
-Opcode_dhi_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x260700;
-}
-
-static void
-Opcode_dii_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x270700;
-}
-
-static void
-Opcode_dpfr_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x200700;
-}
-
-static void
-Opcode_dpfw_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x210700;
-}
-
-static void
-Opcode_dpfro_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x220700;
-}
-
-static void
-Opcode_dpfwo_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x230700;
-}
-
-static void
-Opcode_sdct_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x91f;
-}
-
-static void
-Opcode_ldct_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x81f;
-}
-
-static void
-Opcode_idtlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xc05;
-}
-
-static void
-Opcode_pdtlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xd05;
-}
-
-static void
-Opcode_rdtlb0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xb05;
-}
-
-static void
-Opcode_rdtlb1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf05;
-}
-
-static void
-Opcode_wdtlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe05;
-}
-
-static void
-Opcode_iitlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x405;
-}
-
-static void
-Opcode_pitlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x505;
-}
-
-static void
-Opcode_ritlb0_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x305;
-}
-
-static void
-Opcode_ritlb1_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x705;
-}
-
-static void
-Opcode_witlb_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0x605;
-}
-
-static void
-Opcode_nsa_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xe04;
-}
-
-static void
-Opcode_nsau_Slot_inst_encode (xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = 0xf04;
-}
-
-xtensa_opcode_encode_fn Opcode_excw_encode_fns[] = {
-  Opcode_excw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfe_encode_fns[] = {
-  Opcode_rfe_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfde_encode_fns[] = {
-  Opcode_rfde_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_syscall_encode_fns[] = {
-  Opcode_syscall_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_simcall_encode_fns[] = {
-  Opcode_simcall_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_call12_encode_fns[] = {
-  Opcode_call12_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_call8_encode_fns[] = {
-  Opcode_call8_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_call4_encode_fns[] = {
-  Opcode_call4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_callx12_encode_fns[] = {
-  Opcode_callx12_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_callx8_encode_fns[] = {
-  Opcode_callx8_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_callx4_encode_fns[] = {
-  Opcode_callx4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_entry_encode_fns[] = {
-  Opcode_entry_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_movsp_encode_fns[] = {
-  Opcode_movsp_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rotw_encode_fns[] = {
-  Opcode_rotw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_retw_encode_fns[] = {
-  Opcode_retw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_retw_n_encode_fns[] = {
-  0, 0, Opcode_retw_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_rfwo_encode_fns[] = {
-  Opcode_rfwo_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfwu_encode_fns[] = {
-  Opcode_rfwu_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l32e_encode_fns[] = {
-  Opcode_l32e_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_s32e_encode_fns[] = {
-  Opcode_s32e_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_windowbase_encode_fns[] = {
-  Opcode_rsr_windowbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_windowbase_encode_fns[] = {
-  Opcode_wsr_windowbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_windowbase_encode_fns[] = {
-  Opcode_xsr_windowbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_windowstart_encode_fns[] = {
-  Opcode_rsr_windowstart_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_windowstart_encode_fns[] = {
-  Opcode_wsr_windowstart_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_windowstart_encode_fns[] = {
-  Opcode_xsr_windowstart_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_add_n_encode_fns[] = {
-  0, Opcode_add_n_Slot_inst16a_encode, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addi_n_encode_fns[] = {
-  0, Opcode_addi_n_Slot_inst16a_encode, 0
-};
-
-xtensa_opcode_encode_fn Opcode_beqz_n_encode_fns[] = {
-  0, 0, Opcode_beqz_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_bnez_n_encode_fns[] = {
-  0, 0, Opcode_bnez_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_ill_n_encode_fns[] = {
-  0, 0, Opcode_ill_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_l32i_n_encode_fns[] = {
-  0, Opcode_l32i_n_Slot_inst16a_encode, 0
-};
-
-xtensa_opcode_encode_fn Opcode_mov_n_encode_fns[] = {
-  0, 0, Opcode_mov_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_movi_n_encode_fns[] = {
-  0, 0, Opcode_movi_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_nop_n_encode_fns[] = {
-  0, 0, Opcode_nop_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_ret_n_encode_fns[] = {
-  0, 0, Opcode_ret_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_s32i_n_encode_fns[] = {
-  0, Opcode_s32i_n_Slot_inst16a_encode, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addi_encode_fns[] = {
-  Opcode_addi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addmi_encode_fns[] = {
-  Opcode_addmi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_add_encode_fns[] = {
-  Opcode_add_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sub_encode_fns[] = {
-  Opcode_sub_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addx2_encode_fns[] = {
-  Opcode_addx2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addx4_encode_fns[] = {
-  Opcode_addx4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_addx8_encode_fns[] = {
-  Opcode_addx8_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_subx2_encode_fns[] = {
-  Opcode_subx2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_subx4_encode_fns[] = {
-  Opcode_subx4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_subx8_encode_fns[] = {
-  Opcode_subx8_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_and_encode_fns[] = {
-  Opcode_and_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_or_encode_fns[] = {
-  Opcode_or_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xor_encode_fns[] = {
-  Opcode_xor_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_beqi_encode_fns[] = {
-  Opcode_beqi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bnei_encode_fns[] = {
-  Opcode_bnei_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bgei_encode_fns[] = {
-  Opcode_bgei_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_blti_encode_fns[] = {
-  Opcode_blti_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bbci_encode_fns[] = {
-  Opcode_bbci_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bbsi_encode_fns[] = {
-  Opcode_bbsi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bgeui_encode_fns[] = {
-  Opcode_bgeui_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bltui_encode_fns[] = {
-  Opcode_bltui_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_beq_encode_fns[] = {
-  Opcode_beq_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bne_encode_fns[] = {
-  Opcode_bne_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bge_encode_fns[] = {
-  Opcode_bge_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_blt_encode_fns[] = {
-  Opcode_blt_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bgeu_encode_fns[] = {
-  Opcode_bgeu_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bltu_encode_fns[] = {
-  Opcode_bltu_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bany_encode_fns[] = {
-  Opcode_bany_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bnone_encode_fns[] = {
-  Opcode_bnone_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ball_encode_fns[] = {
-  Opcode_ball_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bnall_encode_fns[] = {
-  Opcode_bnall_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bbc_encode_fns[] = {
-  Opcode_bbc_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bbs_encode_fns[] = {
-  Opcode_bbs_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_beqz_encode_fns[] = {
-  Opcode_beqz_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bnez_encode_fns[] = {
-  Opcode_bnez_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bgez_encode_fns[] = {
-  Opcode_bgez_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_bltz_encode_fns[] = {
-  Opcode_bltz_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_call0_encode_fns[] = {
-  Opcode_call0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_callx0_encode_fns[] = {
-  Opcode_callx0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_extui_encode_fns[] = {
-  Opcode_extui_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ill_encode_fns[] = {
-  Opcode_ill_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_j_encode_fns[] = {
-  Opcode_j_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_jx_encode_fns[] = {
-  Opcode_jx_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l16ui_encode_fns[] = {
-  Opcode_l16ui_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l16si_encode_fns[] = {
-  Opcode_l16si_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l32i_encode_fns[] = {
-  Opcode_l32i_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l32r_encode_fns[] = {
-  Opcode_l32r_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_l8ui_encode_fns[] = {
-  Opcode_l8ui_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_loop_encode_fns[] = {
-  Opcode_loop_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_loopnez_encode_fns[] = {
-  Opcode_loopnez_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_loopgtz_encode_fns[] = {
-  Opcode_loopgtz_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_movi_encode_fns[] = {
-  Opcode_movi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_moveqz_encode_fns[] = {
-  Opcode_moveqz_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_movnez_encode_fns[] = {
-  Opcode_movnez_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_movltz_encode_fns[] = {
-  Opcode_movltz_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_movgez_encode_fns[] = {
-  Opcode_movgez_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_neg_encode_fns[] = {
-  Opcode_neg_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_abs_encode_fns[] = {
-  Opcode_abs_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_nop_encode_fns[] = {
-  Opcode_nop_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ret_encode_fns[] = {
-  Opcode_ret_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_s16i_encode_fns[] = {
-  Opcode_s16i_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_s32i_encode_fns[] = {
-  Opcode_s32i_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_s8i_encode_fns[] = {
-  Opcode_s8i_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ssr_encode_fns[] = {
-  Opcode_ssr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ssl_encode_fns[] = {
-  Opcode_ssl_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ssa8l_encode_fns[] = {
-  Opcode_ssa8l_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ssa8b_encode_fns[] = {
-  Opcode_ssa8b_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ssai_encode_fns[] = {
-  Opcode_ssai_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sll_encode_fns[] = {
-  Opcode_sll_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_src_encode_fns[] = {
-  Opcode_src_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_srl_encode_fns[] = {
-  Opcode_srl_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sra_encode_fns[] = {
-  Opcode_sra_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_slli_encode_fns[] = {
-  Opcode_slli_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_srai_encode_fns[] = {
-  Opcode_srai_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_srli_encode_fns[] = {
-  Opcode_srli_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_memw_encode_fns[] = {
-  Opcode_memw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_extw_encode_fns[] = {
-  Opcode_extw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_isync_encode_fns[] = {
-  Opcode_isync_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsync_encode_fns[] = {
-  Opcode_rsync_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_esync_encode_fns[] = {
-  Opcode_esync_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dsync_encode_fns[] = {
-  Opcode_dsync_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsil_encode_fns[] = {
-  Opcode_rsil_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_lend_encode_fns[] = {
-  Opcode_rsr_lend_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_lend_encode_fns[] = {
-  Opcode_wsr_lend_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_lend_encode_fns[] = {
-  Opcode_xsr_lend_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_lcount_encode_fns[] = {
-  Opcode_rsr_lcount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_lcount_encode_fns[] = {
-  Opcode_wsr_lcount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_lcount_encode_fns[] = {
-  Opcode_xsr_lcount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_lbeg_encode_fns[] = {
-  Opcode_rsr_lbeg_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_lbeg_encode_fns[] = {
-  Opcode_wsr_lbeg_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_lbeg_encode_fns[] = {
-  Opcode_xsr_lbeg_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_sar_encode_fns[] = {
-  Opcode_rsr_sar_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_sar_encode_fns[] = {
-  Opcode_wsr_sar_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_sar_encode_fns[] = {
-  Opcode_xsr_sar_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_litbase_encode_fns[] = {
-  Opcode_rsr_litbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_litbase_encode_fns[] = {
-  Opcode_wsr_litbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_litbase_encode_fns[] = {
-  Opcode_xsr_litbase_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_176_encode_fns[] = {
-  Opcode_rsr_176_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_208_encode_fns[] = {
-  Opcode_rsr_208_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ps_encode_fns[] = {
-  Opcode_rsr_ps_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ps_encode_fns[] = {
-  Opcode_wsr_ps_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ps_encode_fns[] = {
-  Opcode_xsr_ps_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_epc1_encode_fns[] = {
-  Opcode_rsr_epc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_epc1_encode_fns[] = {
-  Opcode_wsr_epc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_epc1_encode_fns[] = {
-  Opcode_xsr_epc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_excsave1_encode_fns[] = {
-  Opcode_rsr_excsave1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_excsave1_encode_fns[] = {
-  Opcode_wsr_excsave1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_excsave1_encode_fns[] = {
-  Opcode_xsr_excsave1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_epc2_encode_fns[] = {
-  Opcode_rsr_epc2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_epc2_encode_fns[] = {
-  Opcode_wsr_epc2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_epc2_encode_fns[] = {
-  Opcode_xsr_epc2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_excsave2_encode_fns[] = {
-  Opcode_rsr_excsave2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_excsave2_encode_fns[] = {
-  Opcode_wsr_excsave2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_excsave2_encode_fns[] = {
-  Opcode_xsr_excsave2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_epc3_encode_fns[] = {
-  Opcode_rsr_epc3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_epc3_encode_fns[] = {
-  Opcode_wsr_epc3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_epc3_encode_fns[] = {
-  Opcode_xsr_epc3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_excsave3_encode_fns[] = {
-  Opcode_rsr_excsave3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_excsave3_encode_fns[] = {
-  Opcode_wsr_excsave3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_excsave3_encode_fns[] = {
-  Opcode_xsr_excsave3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_epc4_encode_fns[] = {
-  Opcode_rsr_epc4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_epc4_encode_fns[] = {
-  Opcode_wsr_epc4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_epc4_encode_fns[] = {
-  Opcode_xsr_epc4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_excsave4_encode_fns[] = {
-  Opcode_rsr_excsave4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_excsave4_encode_fns[] = {
-  Opcode_wsr_excsave4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_excsave4_encode_fns[] = {
-  Opcode_xsr_excsave4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_eps2_encode_fns[] = {
-  Opcode_rsr_eps2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_eps2_encode_fns[] = {
-  Opcode_wsr_eps2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_eps2_encode_fns[] = {
-  Opcode_xsr_eps2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_eps3_encode_fns[] = {
-  Opcode_rsr_eps3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_eps3_encode_fns[] = {
-  Opcode_wsr_eps3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_eps3_encode_fns[] = {
-  Opcode_xsr_eps3_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_eps4_encode_fns[] = {
-  Opcode_rsr_eps4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_eps4_encode_fns[] = {
-  Opcode_wsr_eps4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_eps4_encode_fns[] = {
-  Opcode_xsr_eps4_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_excvaddr_encode_fns[] = {
-  Opcode_rsr_excvaddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_excvaddr_encode_fns[] = {
-  Opcode_wsr_excvaddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_excvaddr_encode_fns[] = {
-  Opcode_xsr_excvaddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_depc_encode_fns[] = {
-  Opcode_rsr_depc_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_depc_encode_fns[] = {
-  Opcode_wsr_depc_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_depc_encode_fns[] = {
-  Opcode_xsr_depc_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_exccause_encode_fns[] = {
-  Opcode_rsr_exccause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_exccause_encode_fns[] = {
-  Opcode_wsr_exccause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_exccause_encode_fns[] = {
-  Opcode_xsr_exccause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_misc0_encode_fns[] = {
-  Opcode_rsr_misc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_misc0_encode_fns[] = {
-  Opcode_wsr_misc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_misc0_encode_fns[] = {
-  Opcode_xsr_misc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_misc1_encode_fns[] = {
-  Opcode_rsr_misc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_misc1_encode_fns[] = {
-  Opcode_wsr_misc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_misc1_encode_fns[] = {
-  Opcode_xsr_misc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_prid_encode_fns[] = {
-  Opcode_rsr_prid_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfi_encode_fns[] = {
-  Opcode_rfi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_waiti_encode_fns[] = {
-  Opcode_waiti_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_interrupt_encode_fns[] = {
-  Opcode_rsr_interrupt_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_intset_encode_fns[] = {
-  Opcode_wsr_intset_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_intclear_encode_fns[] = {
-  Opcode_wsr_intclear_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_intenable_encode_fns[] = {
-  Opcode_rsr_intenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_intenable_encode_fns[] = {
-  Opcode_wsr_intenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_intenable_encode_fns[] = {
-  Opcode_xsr_intenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_break_encode_fns[] = {
-  Opcode_break_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_break_n_encode_fns[] = {
-  0, 0, Opcode_break_n_Slot_inst16b_encode
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_dbreaka0_encode_fns[] = {
-  Opcode_rsr_dbreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_dbreaka0_encode_fns[] = {
-  Opcode_wsr_dbreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_dbreaka0_encode_fns[] = {
-  Opcode_xsr_dbreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_dbreakc0_encode_fns[] = {
-  Opcode_rsr_dbreakc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_dbreakc0_encode_fns[] = {
-  Opcode_wsr_dbreakc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_dbreakc0_encode_fns[] = {
-  Opcode_xsr_dbreakc0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_dbreaka1_encode_fns[] = {
-  Opcode_rsr_dbreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_dbreaka1_encode_fns[] = {
-  Opcode_wsr_dbreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_dbreaka1_encode_fns[] = {
-  Opcode_xsr_dbreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_dbreakc1_encode_fns[] = {
-  Opcode_rsr_dbreakc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_dbreakc1_encode_fns[] = {
-  Opcode_wsr_dbreakc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_dbreakc1_encode_fns[] = {
-  Opcode_xsr_dbreakc1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ibreaka0_encode_fns[] = {
-  Opcode_rsr_ibreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ibreaka0_encode_fns[] = {
-  Opcode_wsr_ibreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ibreaka0_encode_fns[] = {
-  Opcode_xsr_ibreaka0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ibreaka1_encode_fns[] = {
-  Opcode_rsr_ibreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ibreaka1_encode_fns[] = {
-  Opcode_wsr_ibreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ibreaka1_encode_fns[] = {
-  Opcode_xsr_ibreaka1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ibreakenable_encode_fns[] = {
-  Opcode_rsr_ibreakenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ibreakenable_encode_fns[] = {
-  Opcode_wsr_ibreakenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ibreakenable_encode_fns[] = {
-  Opcode_xsr_ibreakenable_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_debugcause_encode_fns[] = {
-  Opcode_rsr_debugcause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_debugcause_encode_fns[] = {
-  Opcode_wsr_debugcause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_debugcause_encode_fns[] = {
-  Opcode_xsr_debugcause_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_icount_encode_fns[] = {
-  Opcode_rsr_icount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_icount_encode_fns[] = {
-  Opcode_wsr_icount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_icount_encode_fns[] = {
-  Opcode_xsr_icount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_icountlevel_encode_fns[] = {
-  Opcode_rsr_icountlevel_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_icountlevel_encode_fns[] = {
-  Opcode_wsr_icountlevel_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_icountlevel_encode_fns[] = {
-  Opcode_xsr_icountlevel_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ddr_encode_fns[] = {
-  Opcode_rsr_ddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ddr_encode_fns[] = {
-  Opcode_wsr_ddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ddr_encode_fns[] = {
-  Opcode_xsr_ddr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfdo_encode_fns[] = {
-  Opcode_rfdo_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rfdd_encode_fns[] = {
-  Opcode_rfdd_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ccount_encode_fns[] = {
-  Opcode_rsr_ccount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ccount_encode_fns[] = {
-  Opcode_wsr_ccount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ccount_encode_fns[] = {
-  Opcode_xsr_ccount_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ccompare0_encode_fns[] = {
-  Opcode_rsr_ccompare0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ccompare0_encode_fns[] = {
-  Opcode_wsr_ccompare0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ccompare0_encode_fns[] = {
-  Opcode_xsr_ccompare0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ccompare1_encode_fns[] = {
-  Opcode_rsr_ccompare1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ccompare1_encode_fns[] = {
-  Opcode_wsr_ccompare1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ccompare1_encode_fns[] = {
-  Opcode_xsr_ccompare1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rsr_ccompare2_encode_fns[] = {
-  Opcode_rsr_ccompare2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wsr_ccompare2_encode_fns[] = {
-  Opcode_wsr_ccompare2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_xsr_ccompare2_encode_fns[] = {
-  Opcode_xsr_ccompare2_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ipf_encode_fns[] = {
-  Opcode_ipf_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ihi_encode_fns[] = {
-  Opcode_ihi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_iii_encode_fns[] = {
-  Opcode_iii_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_lict_encode_fns[] = {
-  Opcode_lict_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_licw_encode_fns[] = {
-  Opcode_licw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sict_encode_fns[] = {
-  Opcode_sict_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sicw_encode_fns[] = {
-  Opcode_sicw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dhwb_encode_fns[] = {
-  Opcode_dhwb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dhwbi_encode_fns[] = {
-  Opcode_dhwbi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_diwb_encode_fns[] = {
-  Opcode_diwb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_diwbi_encode_fns[] = {
-  Opcode_diwbi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dhi_encode_fns[] = {
-  Opcode_dhi_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dii_encode_fns[] = {
-  Opcode_dii_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dpfr_encode_fns[] = {
-  Opcode_dpfr_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dpfw_encode_fns[] = {
-  Opcode_dpfw_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dpfro_encode_fns[] = {
-  Opcode_dpfro_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_dpfwo_encode_fns[] = {
-  Opcode_dpfwo_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_sdct_encode_fns[] = {
-  Opcode_sdct_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ldct_encode_fns[] = {
-  Opcode_ldct_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_idtlb_encode_fns[] = {
-  Opcode_idtlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_pdtlb_encode_fns[] = {
-  Opcode_pdtlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rdtlb0_encode_fns[] = {
-  Opcode_rdtlb0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_rdtlb1_encode_fns[] = {
-  Opcode_rdtlb1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_wdtlb_encode_fns[] = {
-  Opcode_wdtlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_iitlb_encode_fns[] = {
-  Opcode_iitlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_pitlb_encode_fns[] = {
-  Opcode_pitlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ritlb0_encode_fns[] = {
-  Opcode_ritlb0_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_ritlb1_encode_fns[] = {
-  Opcode_ritlb1_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_witlb_encode_fns[] = {
-  Opcode_witlb_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_nsa_encode_fns[] = {
-  Opcode_nsa_Slot_inst_encode, 0, 0
-};
-
-xtensa_opcode_encode_fn Opcode_nsau_encode_fns[] = {
-  Opcode_nsau_Slot_inst_encode, 0, 0
-};
-
-
-/* Opcode table.  */
-
-static xtensa_opcode_internal opcodes[] = {
-  { "excw", 0 /* xt_iclass_excw */,
-    0,
-    Opcode_excw_encode_fns, 0, 0 },
-  { "rfe", 1 /* xt_iclass_rfe */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfe_encode_fns, 0, 0 },
-  { "rfde", 2 /* xt_iclass_rfde */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfde_encode_fns, 0, 0 },
-  { "syscall", 3 /* xt_iclass_syscall */,
-    0,
-    Opcode_syscall_encode_fns, 0, 0 },
-  { "simcall", 4 /* xt_iclass_simcall */,
-    0,
-    Opcode_simcall_encode_fns, 0, 0 },
-  { "call12", 5 /* xt_iclass_call12 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_call12_encode_fns, 0, 0 },
-  { "call8", 6 /* xt_iclass_call8 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_call8_encode_fns, 0, 0 },
-  { "call4", 7 /* xt_iclass_call4 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_call4_encode_fns, 0, 0 },
-  { "callx12", 8 /* xt_iclass_callx12 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_callx12_encode_fns, 0, 0 },
-  { "callx8", 9 /* xt_iclass_callx8 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_callx8_encode_fns, 0, 0 },
-  { "callx4", 10 /* xt_iclass_callx4 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_callx4_encode_fns, 0, 0 },
-  { "entry", 11 /* xt_iclass_entry */,
-    0,
-    Opcode_entry_encode_fns, 0, 0 },
-  { "movsp", 12 /* xt_iclass_movsp */,
-    0,
-    Opcode_movsp_encode_fns, 0, 0 },
-  { "rotw", 13 /* xt_iclass_rotw */,
-    0,
-    Opcode_rotw_encode_fns, 0, 0 },
-  { "retw", 14 /* xt_iclass_retw */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_retw_encode_fns, 0, 0 },
-  { "retw.n", 14 /* xt_iclass_retw */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_retw_n_encode_fns, 0, 0 },
-  { "rfwo", 15 /* xt_iclass_rfwou */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfwo_encode_fns, 0, 0 },
-  { "rfwu", 15 /* xt_iclass_rfwou */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfwu_encode_fns, 0, 0 },
-  { "l32e", 16 /* xt_iclass_l32e */,
-    0,
-    Opcode_l32e_encode_fns, 0, 0 },
-  { "s32e", 17 /* xt_iclass_s32e */,
-    0,
-    Opcode_s32e_encode_fns, 0, 0 },
-  { "rsr.windowbase", 18 /* xt_iclass_rsr.windowbase */,
-    0,
-    Opcode_rsr_windowbase_encode_fns, 0, 0 },
-  { "wsr.windowbase", 19 /* xt_iclass_wsr.windowbase */,
-    0,
-    Opcode_wsr_windowbase_encode_fns, 0, 0 },
-  { "xsr.windowbase", 20 /* xt_iclass_xsr.windowbase */,
-    0,
-    Opcode_xsr_windowbase_encode_fns, 0, 0 },
-  { "rsr.windowstart", 21 /* xt_iclass_rsr.windowstart */,
-    0,
-    Opcode_rsr_windowstart_encode_fns, 0, 0 },
-  { "wsr.windowstart", 22 /* xt_iclass_wsr.windowstart */,
-    0,
-    Opcode_wsr_windowstart_encode_fns, 0, 0 },
-  { "xsr.windowstart", 23 /* xt_iclass_xsr.windowstart */,
-    0,
-    Opcode_xsr_windowstart_encode_fns, 0, 0 },
-  { "add.n", 24 /* xt_iclass_add.n */,
-    0,
-    Opcode_add_n_encode_fns, 0, 0 },
-  { "addi.n", 25 /* xt_iclass_addi.n */,
-    0,
-    Opcode_addi_n_encode_fns, 0, 0 },
-  { "beqz.n", 26 /* xt_iclass_bz6 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_beqz_n_encode_fns, 0, 0 },
-  { "bnez.n", 26 /* xt_iclass_bz6 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bnez_n_encode_fns, 0, 0 },
-  { "ill.n", 27 /* xt_iclass_ill.n */,
-    0,
-    Opcode_ill_n_encode_fns, 0, 0 },
-  { "l32i.n", 28 /* xt_iclass_loadi4 */,
-    0,
-    Opcode_l32i_n_encode_fns, 0, 0 },
-  { "mov.n", 29 /* xt_iclass_mov.n */,
-    0,
-    Opcode_mov_n_encode_fns, 0, 0 },
-  { "movi.n", 30 /* xt_iclass_movi.n */,
-    0,
-    Opcode_movi_n_encode_fns, 0, 0 },
-  { "nop.n", 31 /* xt_iclass_nopn */,
-    0,
-    Opcode_nop_n_encode_fns, 0, 0 },
-  { "ret.n", 32 /* xt_iclass_retn */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_ret_n_encode_fns, 0, 0 },
-  { "s32i.n", 33 /* xt_iclass_storei4 */,
-    0,
-    Opcode_s32i_n_encode_fns, 0, 0 },
-  { "addi", 34 /* xt_iclass_addi */,
-    0,
-    Opcode_addi_encode_fns, 0, 0 },
-  { "addmi", 35 /* xt_iclass_addmi */,
-    0,
-    Opcode_addmi_encode_fns, 0, 0 },
-  { "add", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_add_encode_fns, 0, 0 },
-  { "sub", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_sub_encode_fns, 0, 0 },
-  { "addx2", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_addx2_encode_fns, 0, 0 },
-  { "addx4", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_addx4_encode_fns, 0, 0 },
-  { "addx8", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_addx8_encode_fns, 0, 0 },
-  { "subx2", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_subx2_encode_fns, 0, 0 },
-  { "subx4", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_subx4_encode_fns, 0, 0 },
-  { "subx8", 36 /* xt_iclass_addsub */,
-    0,
-    Opcode_subx8_encode_fns, 0, 0 },
-  { "and", 37 /* xt_iclass_bit */,
-    0,
-    Opcode_and_encode_fns, 0, 0 },
-  { "or", 37 /* xt_iclass_bit */,
-    0,
-    Opcode_or_encode_fns, 0, 0 },
-  { "xor", 37 /* xt_iclass_bit */,
-    0,
-    Opcode_xor_encode_fns, 0, 0 },
-  { "beqi", 38 /* xt_iclass_bsi8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_beqi_encode_fns, 0, 0 },
-  { "bnei", 38 /* xt_iclass_bsi8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bnei_encode_fns, 0, 0 },
-  { "bgei", 38 /* xt_iclass_bsi8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bgei_encode_fns, 0, 0 },
-  { "blti", 38 /* xt_iclass_bsi8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_blti_encode_fns, 0, 0 },
-  { "bbci", 39 /* xt_iclass_bsi8b */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bbci_encode_fns, 0, 0 },
-  { "bbsi", 39 /* xt_iclass_bsi8b */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bbsi_encode_fns, 0, 0 },
-  { "bgeui", 40 /* xt_iclass_bsi8u */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bgeui_encode_fns, 0, 0 },
-  { "bltui", 40 /* xt_iclass_bsi8u */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bltui_encode_fns, 0, 0 },
-  { "beq", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_beq_encode_fns, 0, 0 },
-  { "bne", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bne_encode_fns, 0, 0 },
-  { "bge", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bge_encode_fns, 0, 0 },
-  { "blt", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_blt_encode_fns, 0, 0 },
-  { "bgeu", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bgeu_encode_fns, 0, 0 },
-  { "bltu", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bltu_encode_fns, 0, 0 },
-  { "bany", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bany_encode_fns, 0, 0 },
-  { "bnone", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bnone_encode_fns, 0, 0 },
-  { "ball", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_ball_encode_fns, 0, 0 },
-  { "bnall", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bnall_encode_fns, 0, 0 },
-  { "bbc", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bbc_encode_fns, 0, 0 },
-  { "bbs", 41 /* xt_iclass_bst8 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bbs_encode_fns, 0, 0 },
-  { "beqz", 42 /* xt_iclass_bsz12 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_beqz_encode_fns, 0, 0 },
-  { "bnez", 42 /* xt_iclass_bsz12 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bnez_encode_fns, 0, 0 },
-  { "bgez", 42 /* xt_iclass_bsz12 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bgez_encode_fns, 0, 0 },
-  { "bltz", 42 /* xt_iclass_bsz12 */,
-    XTENSA_OPCODE_IS_BRANCH,
-    Opcode_bltz_encode_fns, 0, 0 },
-  { "call0", 43 /* xt_iclass_call0 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_call0_encode_fns, 0, 0 },
-  { "callx0", 44 /* xt_iclass_callx0 */,
-    XTENSA_OPCODE_IS_CALL,
-    Opcode_callx0_encode_fns, 0, 0 },
-  { "extui", 45 /* xt_iclass_exti */,
-    0,
-    Opcode_extui_encode_fns, 0, 0 },
-  { "ill", 46 /* xt_iclass_ill */,
-    0,
-    Opcode_ill_encode_fns, 0, 0 },
-  { "j", 47 /* xt_iclass_jump */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_j_encode_fns, 0, 0 },
-  { "jx", 48 /* xt_iclass_jumpx */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_jx_encode_fns, 0, 0 },
-  { "l16ui", 49 /* xt_iclass_l16ui */,
-    0,
-    Opcode_l16ui_encode_fns, 0, 0 },
-  { "l16si", 50 /* xt_iclass_l16si */,
-    0,
-    Opcode_l16si_encode_fns, 0, 0 },
-  { "l32i", 51 /* xt_iclass_l32i */,
-    0,
-    Opcode_l32i_encode_fns, 0, 0 },
-  { "l32r", 52 /* xt_iclass_l32r */,
-    0,
-    Opcode_l32r_encode_fns, 0, 0 },
-  { "l8ui", 53 /* xt_iclass_l8i */,
-    0,
-    Opcode_l8ui_encode_fns, 0, 0 },
-  { "loop", 54 /* xt_iclass_loop */,
-    XTENSA_OPCODE_IS_LOOP,
-    Opcode_loop_encode_fns, 0, 0 },
-  { "loopnez", 55 /* xt_iclass_loopz */,
-    XTENSA_OPCODE_IS_LOOP,
-    Opcode_loopnez_encode_fns, 0, 0 },
-  { "loopgtz", 55 /* xt_iclass_loopz */,
-    XTENSA_OPCODE_IS_LOOP,
-    Opcode_loopgtz_encode_fns, 0, 0 },
-  { "movi", 56 /* xt_iclass_movi */,
-    0,
-    Opcode_movi_encode_fns, 0, 0 },
-  { "moveqz", 57 /* xt_iclass_movz */,
-    0,
-    Opcode_moveqz_encode_fns, 0, 0 },
-  { "movnez", 57 /* xt_iclass_movz */,
-    0,
-    Opcode_movnez_encode_fns, 0, 0 },
-  { "movltz", 57 /* xt_iclass_movz */,
-    0,
-    Opcode_movltz_encode_fns, 0, 0 },
-  { "movgez", 57 /* xt_iclass_movz */,
-    0,
-    Opcode_movgez_encode_fns, 0, 0 },
-  { "neg", 58 /* xt_iclass_neg */,
-    0,
-    Opcode_neg_encode_fns, 0, 0 },
-  { "abs", 58 /* xt_iclass_neg */,
-    0,
-    Opcode_abs_encode_fns, 0, 0 },
-  { "nop", 59 /* xt_iclass_nop */,
-    0,
-    Opcode_nop_encode_fns, 0, 0 },
-  { "ret", 60 /* xt_iclass_return */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_ret_encode_fns, 0, 0 },
-  { "s16i", 61 /* xt_iclass_s16i */,
-    0,
-    Opcode_s16i_encode_fns, 0, 0 },
-  { "s32i", 62 /* xt_iclass_s32i */,
-    0,
-    Opcode_s32i_encode_fns, 0, 0 },
-  { "s8i", 63 /* xt_iclass_s8i */,
-    0,
-    Opcode_s8i_encode_fns, 0, 0 },
-  { "ssr", 64 /* xt_iclass_sar */,
-    0,
-    Opcode_ssr_encode_fns, 0, 0 },
-  { "ssl", 64 /* xt_iclass_sar */,
-    0,
-    Opcode_ssl_encode_fns, 0, 0 },
-  { "ssa8l", 64 /* xt_iclass_sar */,
-    0,
-    Opcode_ssa8l_encode_fns, 0, 0 },
-  { "ssa8b", 64 /* xt_iclass_sar */,
-    0,
-    Opcode_ssa8b_encode_fns, 0, 0 },
-  { "ssai", 65 /* xt_iclass_sari */,
-    0,
-    Opcode_ssai_encode_fns, 0, 0 },
-  { "sll", 66 /* xt_iclass_shifts */,
-    0,
-    Opcode_sll_encode_fns, 0, 0 },
-  { "src", 67 /* xt_iclass_shiftst */,
-    0,
-    Opcode_src_encode_fns, 0, 0 },
-  { "srl", 68 /* xt_iclass_shiftt */,
-    0,
-    Opcode_srl_encode_fns, 0, 0 },
-  { "sra", 68 /* xt_iclass_shiftt */,
-    0,
-    Opcode_sra_encode_fns, 0, 0 },
-  { "slli", 69 /* xt_iclass_slli */,
-    0,
-    Opcode_slli_encode_fns, 0, 0 },
-  { "srai", 70 /* xt_iclass_srai */,
-    0,
-    Opcode_srai_encode_fns, 0, 0 },
-  { "srli", 71 /* xt_iclass_srli */,
-    0,
-    Opcode_srli_encode_fns, 0, 0 },
-  { "memw", 72 /* xt_iclass_memw */,
-    0,
-    Opcode_memw_encode_fns, 0, 0 },
-  { "extw", 73 /* xt_iclass_extw */,
-    0,
-    Opcode_extw_encode_fns, 0, 0 },
-  { "isync", 74 /* xt_iclass_isync */,
-    0,
-    Opcode_isync_encode_fns, 0, 0 },
-  { "rsync", 75 /* xt_iclass_sync */,
-    0,
-    Opcode_rsync_encode_fns, 0, 0 },
-  { "esync", 75 /* xt_iclass_sync */,
-    0,
-    Opcode_esync_encode_fns, 0, 0 },
-  { "dsync", 75 /* xt_iclass_sync */,
-    0,
-    Opcode_dsync_encode_fns, 0, 0 },
-  { "rsil", 76 /* xt_iclass_rsil */,
-    0,
-    Opcode_rsil_encode_fns, 0, 0 },
-  { "rsr.lend", 77 /* xt_iclass_rsr.lend */,
-    0,
-    Opcode_rsr_lend_encode_fns, 0, 0 },
-  { "wsr.lend", 78 /* xt_iclass_wsr.lend */,
-    0,
-    Opcode_wsr_lend_encode_fns, 0, 0 },
-  { "xsr.lend", 79 /* xt_iclass_xsr.lend */,
-    0,
-    Opcode_xsr_lend_encode_fns, 0, 0 },
-  { "rsr.lcount", 80 /* xt_iclass_rsr.lcount */,
-    0,
-    Opcode_rsr_lcount_encode_fns, 0, 0 },
-  { "wsr.lcount", 81 /* xt_iclass_wsr.lcount */,
-    0,
-    Opcode_wsr_lcount_encode_fns, 0, 0 },
-  { "xsr.lcount", 82 /* xt_iclass_xsr.lcount */,
-    0,
-    Opcode_xsr_lcount_encode_fns, 0, 0 },
-  { "rsr.lbeg", 83 /* xt_iclass_rsr.lbeg */,
-    0,
-    Opcode_rsr_lbeg_encode_fns, 0, 0 },
-  { "wsr.lbeg", 84 /* xt_iclass_wsr.lbeg */,
-    0,
-    Opcode_wsr_lbeg_encode_fns, 0, 0 },
-  { "xsr.lbeg", 85 /* xt_iclass_xsr.lbeg */,
-    0,
-    Opcode_xsr_lbeg_encode_fns, 0, 0 },
-  { "rsr.sar", 86 /* xt_iclass_rsr.sar */,
-    0,
-    Opcode_rsr_sar_encode_fns, 0, 0 },
-  { "wsr.sar", 87 /* xt_iclass_wsr.sar */,
-    0,
-    Opcode_wsr_sar_encode_fns, 0, 0 },
-  { "xsr.sar", 88 /* xt_iclass_xsr.sar */,
-    0,
-    Opcode_xsr_sar_encode_fns, 0, 0 },
-  { "rsr.litbase", 89 /* xt_iclass_rsr.litbase */,
-    0,
-    Opcode_rsr_litbase_encode_fns, 0, 0 },
-  { "wsr.litbase", 90 /* xt_iclass_wsr.litbase */,
-    0,
-    Opcode_wsr_litbase_encode_fns, 0, 0 },
-  { "xsr.litbase", 91 /* xt_iclass_xsr.litbase */,
-    0,
-    Opcode_xsr_litbase_encode_fns, 0, 0 },
-  { "rsr.176", 92 /* xt_iclass_rsr.176 */,
-    0,
-    Opcode_rsr_176_encode_fns, 0, 0 },
-  { "rsr.208", 93 /* xt_iclass_rsr.208 */,
-    0,
-    Opcode_rsr_208_encode_fns, 0, 0 },
-  { "rsr.ps", 94 /* xt_iclass_rsr.ps */,
-    0,
-    Opcode_rsr_ps_encode_fns, 0, 0 },
-  { "wsr.ps", 95 /* xt_iclass_wsr.ps */,
-    0,
-    Opcode_wsr_ps_encode_fns, 0, 0 },
-  { "xsr.ps", 96 /* xt_iclass_xsr.ps */,
-    0,
-    Opcode_xsr_ps_encode_fns, 0, 0 },
-  { "rsr.epc1", 97 /* xt_iclass_rsr.epc1 */,
-    0,
-    Opcode_rsr_epc1_encode_fns, 0, 0 },
-  { "wsr.epc1", 98 /* xt_iclass_wsr.epc1 */,
-    0,
-    Opcode_wsr_epc1_encode_fns, 0, 0 },
-  { "xsr.epc1", 99 /* xt_iclass_xsr.epc1 */,
-    0,
-    Opcode_xsr_epc1_encode_fns, 0, 0 },
-  { "rsr.excsave1", 100 /* xt_iclass_rsr.excsave1 */,
-    0,
-    Opcode_rsr_excsave1_encode_fns, 0, 0 },
-  { "wsr.excsave1", 101 /* xt_iclass_wsr.excsave1 */,
-    0,
-    Opcode_wsr_excsave1_encode_fns, 0, 0 },
-  { "xsr.excsave1", 102 /* xt_iclass_xsr.excsave1 */,
-    0,
-    Opcode_xsr_excsave1_encode_fns, 0, 0 },
-  { "rsr.epc2", 103 /* xt_iclass_rsr.epc2 */,
-    0,
-    Opcode_rsr_epc2_encode_fns, 0, 0 },
-  { "wsr.epc2", 104 /* xt_iclass_wsr.epc2 */,
-    0,
-    Opcode_wsr_epc2_encode_fns, 0, 0 },
-  { "xsr.epc2", 105 /* xt_iclass_xsr.epc2 */,
-    0,
-    Opcode_xsr_epc2_encode_fns, 0, 0 },
-  { "rsr.excsave2", 106 /* xt_iclass_rsr.excsave2 */,
-    0,
-    Opcode_rsr_excsave2_encode_fns, 0, 0 },
-  { "wsr.excsave2", 107 /* xt_iclass_wsr.excsave2 */,
-    0,
-    Opcode_wsr_excsave2_encode_fns, 0, 0 },
-  { "xsr.excsave2", 108 /* xt_iclass_xsr.excsave2 */,
-    0,
-    Opcode_xsr_excsave2_encode_fns, 0, 0 },
-  { "rsr.epc3", 109 /* xt_iclass_rsr.epc3 */,
-    0,
-    Opcode_rsr_epc3_encode_fns, 0, 0 },
-  { "wsr.epc3", 110 /* xt_iclass_wsr.epc3 */,
-    0,
-    Opcode_wsr_epc3_encode_fns, 0, 0 },
-  { "xsr.epc3", 111 /* xt_iclass_xsr.epc3 */,
-    0,
-    Opcode_xsr_epc3_encode_fns, 0, 0 },
-  { "rsr.excsave3", 112 /* xt_iclass_rsr.excsave3 */,
-    0,
-    Opcode_rsr_excsave3_encode_fns, 0, 0 },
-  { "wsr.excsave3", 113 /* xt_iclass_wsr.excsave3 */,
-    0,
-    Opcode_wsr_excsave3_encode_fns, 0, 0 },
-  { "xsr.excsave3", 114 /* xt_iclass_xsr.excsave3 */,
-    0,
-    Opcode_xsr_excsave3_encode_fns, 0, 0 },
-  { "rsr.epc4", 115 /* xt_iclass_rsr.epc4 */,
-    0,
-    Opcode_rsr_epc4_encode_fns, 0, 0 },
-  { "wsr.epc4", 116 /* xt_iclass_wsr.epc4 */,
-    0,
-    Opcode_wsr_epc4_encode_fns, 0, 0 },
-  { "xsr.epc4", 117 /* xt_iclass_xsr.epc4 */,
-    0,
-    Opcode_xsr_epc4_encode_fns, 0, 0 },
-  { "rsr.excsave4", 118 /* xt_iclass_rsr.excsave4 */,
-    0,
-    Opcode_rsr_excsave4_encode_fns, 0, 0 },
-  { "wsr.excsave4", 119 /* xt_iclass_wsr.excsave4 */,
-    0,
-    Opcode_wsr_excsave4_encode_fns, 0, 0 },
-  { "xsr.excsave4", 120 /* xt_iclass_xsr.excsave4 */,
-    0,
-    Opcode_xsr_excsave4_encode_fns, 0, 0 },
-  { "rsr.eps2", 121 /* xt_iclass_rsr.eps2 */,
-    0,
-    Opcode_rsr_eps2_encode_fns, 0, 0 },
-  { "wsr.eps2", 122 /* xt_iclass_wsr.eps2 */,
-    0,
-    Opcode_wsr_eps2_encode_fns, 0, 0 },
-  { "xsr.eps2", 123 /* xt_iclass_xsr.eps2 */,
-    0,
-    Opcode_xsr_eps2_encode_fns, 0, 0 },
-  { "rsr.eps3", 124 /* xt_iclass_rsr.eps3 */,
-    0,
-    Opcode_rsr_eps3_encode_fns, 0, 0 },
-  { "wsr.eps3", 125 /* xt_iclass_wsr.eps3 */,
-    0,
-    Opcode_wsr_eps3_encode_fns, 0, 0 },
-  { "xsr.eps3", 126 /* xt_iclass_xsr.eps3 */,
-    0,
-    Opcode_xsr_eps3_encode_fns, 0, 0 },
-  { "rsr.eps4", 127 /* xt_iclass_rsr.eps4 */,
-    0,
-    Opcode_rsr_eps4_encode_fns, 0, 0 },
-  { "wsr.eps4", 128 /* xt_iclass_wsr.eps4 */,
-    0,
-    Opcode_wsr_eps4_encode_fns, 0, 0 },
-  { "xsr.eps4", 129 /* xt_iclass_xsr.eps4 */,
-    0,
-    Opcode_xsr_eps4_encode_fns, 0, 0 },
-  { "rsr.excvaddr", 130 /* xt_iclass_rsr.excvaddr */,
-    0,
-    Opcode_rsr_excvaddr_encode_fns, 0, 0 },
-  { "wsr.excvaddr", 131 /* xt_iclass_wsr.excvaddr */,
-    0,
-    Opcode_wsr_excvaddr_encode_fns, 0, 0 },
-  { "xsr.excvaddr", 132 /* xt_iclass_xsr.excvaddr */,
-    0,
-    Opcode_xsr_excvaddr_encode_fns, 0, 0 },
-  { "rsr.depc", 133 /* xt_iclass_rsr.depc */,
-    0,
-    Opcode_rsr_depc_encode_fns, 0, 0 },
-  { "wsr.depc", 134 /* xt_iclass_wsr.depc */,
-    0,
-    Opcode_wsr_depc_encode_fns, 0, 0 },
-  { "xsr.depc", 135 /* xt_iclass_xsr.depc */,
-    0,
-    Opcode_xsr_depc_encode_fns, 0, 0 },
-  { "rsr.exccause", 136 /* xt_iclass_rsr.exccause */,
-    0,
-    Opcode_rsr_exccause_encode_fns, 0, 0 },
-  { "wsr.exccause", 137 /* xt_iclass_wsr.exccause */,
-    0,
-    Opcode_wsr_exccause_encode_fns, 0, 0 },
-  { "xsr.exccause", 138 /* xt_iclass_xsr.exccause */,
-    0,
-    Opcode_xsr_exccause_encode_fns, 0, 0 },
-  { "rsr.misc0", 139 /* xt_iclass_rsr.misc0 */,
-    0,
-    Opcode_rsr_misc0_encode_fns, 0, 0 },
-  { "wsr.misc0", 140 /* xt_iclass_wsr.misc0 */,
-    0,
-    Opcode_wsr_misc0_encode_fns, 0, 0 },
-  { "xsr.misc0", 141 /* xt_iclass_xsr.misc0 */,
-    0,
-    Opcode_xsr_misc0_encode_fns, 0, 0 },
-  { "rsr.misc1", 142 /* xt_iclass_rsr.misc1 */,
-    0,
-    Opcode_rsr_misc1_encode_fns, 0, 0 },
-  { "wsr.misc1", 143 /* xt_iclass_wsr.misc1 */,
-    0,
-    Opcode_wsr_misc1_encode_fns, 0, 0 },
-  { "xsr.misc1", 144 /* xt_iclass_xsr.misc1 */,
-    0,
-    Opcode_xsr_misc1_encode_fns, 0, 0 },
-  { "rsr.prid", 145 /* xt_iclass_rsr.prid */,
-    0,
-    Opcode_rsr_prid_encode_fns, 0, 0 },
-  { "rfi", 146 /* xt_iclass_rfi */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfi_encode_fns, 0, 0 },
-  { "waiti", 147 /* xt_iclass_wait */,
-    0,
-    Opcode_waiti_encode_fns, 0, 0 },
-  { "rsr.interrupt", 148 /* xt_iclass_rsr.interrupt */,
-    0,
-    Opcode_rsr_interrupt_encode_fns, 0, 0 },
-  { "wsr.intset", 149 /* xt_iclass_wsr.intset */,
-    0,
-    Opcode_wsr_intset_encode_fns, 0, 0 },
-  { "wsr.intclear", 150 /* xt_iclass_wsr.intclear */,
-    0,
-    Opcode_wsr_intclear_encode_fns, 0, 0 },
-  { "rsr.intenable", 151 /* xt_iclass_rsr.intenable */,
-    0,
-    Opcode_rsr_intenable_encode_fns, 0, 0 },
-  { "wsr.intenable", 152 /* xt_iclass_wsr.intenable */,
-    0,
-    Opcode_wsr_intenable_encode_fns, 0, 0 },
-  { "xsr.intenable", 153 /* xt_iclass_xsr.intenable */,
-    0,
-    Opcode_xsr_intenable_encode_fns, 0, 0 },
-  { "break", 154 /* xt_iclass_break */,
-    0,
-    Opcode_break_encode_fns, 0, 0 },
-  { "break.n", 155 /* xt_iclass_break.n */,
-    0,
-    Opcode_break_n_encode_fns, 0, 0 },
-  { "rsr.dbreaka0", 156 /* xt_iclass_rsr.dbreaka0 */,
-    0,
-    Opcode_rsr_dbreaka0_encode_fns, 0, 0 },
-  { "wsr.dbreaka0", 157 /* xt_iclass_wsr.dbreaka0 */,
-    0,
-    Opcode_wsr_dbreaka0_encode_fns, 0, 0 },
-  { "xsr.dbreaka0", 158 /* xt_iclass_xsr.dbreaka0 */,
-    0,
-    Opcode_xsr_dbreaka0_encode_fns, 0, 0 },
-  { "rsr.dbreakc0", 159 /* xt_iclass_rsr.dbreakc0 */,
-    0,
-    Opcode_rsr_dbreakc0_encode_fns, 0, 0 },
-  { "wsr.dbreakc0", 160 /* xt_iclass_wsr.dbreakc0 */,
-    0,
-    Opcode_wsr_dbreakc0_encode_fns, 0, 0 },
-  { "xsr.dbreakc0", 161 /* xt_iclass_xsr.dbreakc0 */,
-    0,
-    Opcode_xsr_dbreakc0_encode_fns, 0, 0 },
-  { "rsr.dbreaka1", 162 /* xt_iclass_rsr.dbreaka1 */,
-    0,
-    Opcode_rsr_dbreaka1_encode_fns, 0, 0 },
-  { "wsr.dbreaka1", 163 /* xt_iclass_wsr.dbreaka1 */,
-    0,
-    Opcode_wsr_dbreaka1_encode_fns, 0, 0 },
-  { "xsr.dbreaka1", 164 /* xt_iclass_xsr.dbreaka1 */,
-    0,
-    Opcode_xsr_dbreaka1_encode_fns, 0, 0 },
-  { "rsr.dbreakc1", 165 /* xt_iclass_rsr.dbreakc1 */,
-    0,
-    Opcode_rsr_dbreakc1_encode_fns, 0, 0 },
-  { "wsr.dbreakc1", 166 /* xt_iclass_wsr.dbreakc1 */,
-    0,
-    Opcode_wsr_dbreakc1_encode_fns, 0, 0 },
-  { "xsr.dbreakc1", 167 /* xt_iclass_xsr.dbreakc1 */,
-    0,
-    Opcode_xsr_dbreakc1_encode_fns, 0, 0 },
-  { "rsr.ibreaka0", 168 /* xt_iclass_rsr.ibreaka0 */,
-    0,
-    Opcode_rsr_ibreaka0_encode_fns, 0, 0 },
-  { "wsr.ibreaka0", 169 /* xt_iclass_wsr.ibreaka0 */,
-    0,
-    Opcode_wsr_ibreaka0_encode_fns, 0, 0 },
-  { "xsr.ibreaka0", 170 /* xt_iclass_xsr.ibreaka0 */,
-    0,
-    Opcode_xsr_ibreaka0_encode_fns, 0, 0 },
-  { "rsr.ibreaka1", 171 /* xt_iclass_rsr.ibreaka1 */,
-    0,
-    Opcode_rsr_ibreaka1_encode_fns, 0, 0 },
-  { "wsr.ibreaka1", 172 /* xt_iclass_wsr.ibreaka1 */,
-    0,
-    Opcode_wsr_ibreaka1_encode_fns, 0, 0 },
-  { "xsr.ibreaka1", 173 /* xt_iclass_xsr.ibreaka1 */,
-    0,
-    Opcode_xsr_ibreaka1_encode_fns, 0, 0 },
-  { "rsr.ibreakenable", 174 /* xt_iclass_rsr.ibreakenable */,
-    0,
-    Opcode_rsr_ibreakenable_encode_fns, 0, 0 },
-  { "wsr.ibreakenable", 175 /* xt_iclass_wsr.ibreakenable */,
-    0,
-    Opcode_wsr_ibreakenable_encode_fns, 0, 0 },
-  { "xsr.ibreakenable", 176 /* xt_iclass_xsr.ibreakenable */,
-    0,
-    Opcode_xsr_ibreakenable_encode_fns, 0, 0 },
-  { "rsr.debugcause", 177 /* xt_iclass_rsr.debugcause */,
-    0,
-    Opcode_rsr_debugcause_encode_fns, 0, 0 },
-  { "wsr.debugcause", 178 /* xt_iclass_wsr.debugcause */,
-    0,
-    Opcode_wsr_debugcause_encode_fns, 0, 0 },
-  { "xsr.debugcause", 179 /* xt_iclass_xsr.debugcause */,
-    0,
-    Opcode_xsr_debugcause_encode_fns, 0, 0 },
-  { "rsr.icount", 180 /* xt_iclass_rsr.icount */,
-    0,
-    Opcode_rsr_icount_encode_fns, 0, 0 },
-  { "wsr.icount", 181 /* xt_iclass_wsr.icount */,
-    0,
-    Opcode_wsr_icount_encode_fns, 0, 0 },
-  { "xsr.icount", 182 /* xt_iclass_xsr.icount */,
-    0,
-    Opcode_xsr_icount_encode_fns, 0, 0 },
-  { "rsr.icountlevel", 183 /* xt_iclass_rsr.icountlevel */,
-    0,
-    Opcode_rsr_icountlevel_encode_fns, 0, 0 },
-  { "wsr.icountlevel", 184 /* xt_iclass_wsr.icountlevel */,
-    0,
-    Opcode_wsr_icountlevel_encode_fns, 0, 0 },
-  { "xsr.icountlevel", 185 /* xt_iclass_xsr.icountlevel */,
-    0,
-    Opcode_xsr_icountlevel_encode_fns, 0, 0 },
-  { "rsr.ddr", 186 /* xt_iclass_rsr.ddr */,
-    0,
-    Opcode_rsr_ddr_encode_fns, 0, 0 },
-  { "wsr.ddr", 187 /* xt_iclass_wsr.ddr */,
-    0,
-    Opcode_wsr_ddr_encode_fns, 0, 0 },
-  { "xsr.ddr", 188 /* xt_iclass_xsr.ddr */,
-    0,
-    Opcode_xsr_ddr_encode_fns, 0, 0 },
-  { "rfdo", 189 /* xt_iclass_rfdo */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfdo_encode_fns, 0, 0 },
-  { "rfdd", 190 /* xt_iclass_rfdd */,
-    XTENSA_OPCODE_IS_JUMP,
-    Opcode_rfdd_encode_fns, 0, 0 },
-  { "rsr.ccount", 191 /* xt_iclass_rsr.ccount */,
-    0,
-    Opcode_rsr_ccount_encode_fns, 0, 0 },
-  { "wsr.ccount", 192 /* xt_iclass_wsr.ccount */,
-    0,
-    Opcode_wsr_ccount_encode_fns, 0, 0 },
-  { "xsr.ccount", 193 /* xt_iclass_xsr.ccount */,
-    0,
-    Opcode_xsr_ccount_encode_fns, 0, 0 },
-  { "rsr.ccompare0", 194 /* xt_iclass_rsr.ccompare0 */,
-    0,
-    Opcode_rsr_ccompare0_encode_fns, 0, 0 },
-  { "wsr.ccompare0", 195 /* xt_iclass_wsr.ccompare0 */,
-    0,
-    Opcode_wsr_ccompare0_encode_fns, 0, 0 },
-  { "xsr.ccompare0", 196 /* xt_iclass_xsr.ccompare0 */,
-    0,
-    Opcode_xsr_ccompare0_encode_fns, 0, 0 },
-  { "rsr.ccompare1", 197 /* xt_iclass_rsr.ccompare1 */,
-    0,
-    Opcode_rsr_ccompare1_encode_fns, 0, 0 },
-  { "wsr.ccompare1", 198 /* xt_iclass_wsr.ccompare1 */,
-    0,
-    Opcode_wsr_ccompare1_encode_fns, 0, 0 },
-  { "xsr.ccompare1", 199 /* xt_iclass_xsr.ccompare1 */,
-    0,
-    Opcode_xsr_ccompare1_encode_fns, 0, 0 },
-  { "rsr.ccompare2", 200 /* xt_iclass_rsr.ccompare2 */,
-    0,
-    Opcode_rsr_ccompare2_encode_fns, 0, 0 },
-  { "wsr.ccompare2", 201 /* xt_iclass_wsr.ccompare2 */,
-    0,
-    Opcode_wsr_ccompare2_encode_fns, 0, 0 },
-  { "xsr.ccompare2", 202 /* xt_iclass_xsr.ccompare2 */,
-    0,
-    Opcode_xsr_ccompare2_encode_fns, 0, 0 },
-  { "ipf", 203 /* xt_iclass_icache */,
-    0,
-    Opcode_ipf_encode_fns, 0, 0 },
-  { "ihi", 203 /* xt_iclass_icache */,
-    0,
-    Opcode_ihi_encode_fns, 0, 0 },
-  { "iii", 204 /* xt_iclass_icache_inv */,
-    0,
-    Opcode_iii_encode_fns, 0, 0 },
-  { "lict", 205 /* xt_iclass_licx */,
-    0,
-    Opcode_lict_encode_fns, 0, 0 },
-  { "licw", 205 /* xt_iclass_licx */,
-    0,
-    Opcode_licw_encode_fns, 0, 0 },
-  { "sict", 206 /* xt_iclass_sicx */,
-    0,
-    Opcode_sict_encode_fns, 0, 0 },
-  { "sicw", 206 /* xt_iclass_sicx */,
-    0,
-    Opcode_sicw_encode_fns, 0, 0 },
-  { "dhwb", 207 /* xt_iclass_dcache */,
-    0,
-    Opcode_dhwb_encode_fns, 0, 0 },
-  { "dhwbi", 207 /* xt_iclass_dcache */,
-    0,
-    Opcode_dhwbi_encode_fns, 0, 0 },
-  { "diwb", 208 /* xt_iclass_dcache_ind */,
-    0,
-    Opcode_diwb_encode_fns, 0, 0 },
-  { "diwbi", 208 /* xt_iclass_dcache_ind */,
-    0,
-    Opcode_diwbi_encode_fns, 0, 0 },
-  { "dhi", 209 /* xt_iclass_dcache_inv */,
-    0,
-    Opcode_dhi_encode_fns, 0, 0 },
-  { "dii", 209 /* xt_iclass_dcache_inv */,
-    0,
-    Opcode_dii_encode_fns, 0, 0 },
-  { "dpfr", 210 /* xt_iclass_dpf */,
-    0,
-    Opcode_dpfr_encode_fns, 0, 0 },
-  { "dpfw", 210 /* xt_iclass_dpf */,
-    0,
-    Opcode_dpfw_encode_fns, 0, 0 },
-  { "dpfro", 210 /* xt_iclass_dpf */,
-    0,
-    Opcode_dpfro_encode_fns, 0, 0 },
-  { "dpfwo", 210 /* xt_iclass_dpf */,
-    0,
-    Opcode_dpfwo_encode_fns, 0, 0 },
-  { "sdct", 211 /* xt_iclass_sdct */,
-    0,
-    Opcode_sdct_encode_fns, 0, 0 },
-  { "ldct", 212 /* xt_iclass_ldct */,
-    0,
-    Opcode_ldct_encode_fns, 0, 0 },
-  { "idtlb", 213 /* xt_iclass_idtlb */,
-    0,
-    Opcode_idtlb_encode_fns, 0, 0 },
-  { "pdtlb", 214 /* xt_iclass_rdtlb */,
-    0,
-    Opcode_pdtlb_encode_fns, 0, 0 },
-  { "rdtlb0", 214 /* xt_iclass_rdtlb */,
-    0,
-    Opcode_rdtlb0_encode_fns, 0, 0 },
-  { "rdtlb1", 214 /* xt_iclass_rdtlb */,
-    0,
-    Opcode_rdtlb1_encode_fns, 0, 0 },
-  { "wdtlb", 215 /* xt_iclass_wdtlb */,
-    0,
-    Opcode_wdtlb_encode_fns, 0, 0 },
-  { "iitlb", 216 /* xt_iclass_iitlb */,
-    0,
-    Opcode_iitlb_encode_fns, 0, 0 },
-  { "pitlb", 217 /* xt_iclass_ritlb */,
-    0,
-    Opcode_pitlb_encode_fns, 0, 0 },
-  { "ritlb0", 217 /* xt_iclass_ritlb */,
-    0,
-    Opcode_ritlb0_encode_fns, 0, 0 },
-  { "ritlb1", 217 /* xt_iclass_ritlb */,
-    0,
-    Opcode_ritlb1_encode_fns, 0, 0 },
-  { "witlb", 218 /* xt_iclass_witlb */,
-    0,
-    Opcode_witlb_encode_fns, 0, 0 },
-  { "nsa", 219 /* xt_iclass_nsa */,
-    0,
-    Opcode_nsa_encode_fns, 0, 0 },
-  { "nsau", 219 /* xt_iclass_nsa */,
-    0,
-    Opcode_nsau_encode_fns, 0, 0 }
-};
-
-
-/* Slot-specific opcode decode functions.  */
-
-static int
-Slot_inst_decode (const xtensa_insnbuf insn)
-{
-  switch (Field_op0_Slot_inst_get (insn))
-    {
-    case 0:
-      switch (Field_op1_Slot_inst_get (insn))
-	{
-	case 0:
-	  switch (Field_op2_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      switch (Field_r_Slot_inst_get (insn))
-		{
-		case 0:
-		  switch (Field_m_Slot_inst_get (insn))
-		    {
-		    case 0:
-		      return 77; /* ill */
-		    case 2:
-		      switch (Field_n_Slot_inst_get (insn))
-			{
-			case 0:
-			  return 96; /* ret */
-			case 1:
-			  return 14; /* retw */
-			case 2:
-			  return 79; /* jx */
-			}
-		      break;
-		    case 3:
-		      switch (Field_n_Slot_inst_get (insn))
-			{
-			case 0:
-			  return 75; /* callx0 */
-			case 1:
-			  return 10; /* callx4 */
-			case 2:
-			  return 9; /* callx8 */
-			case 3:
-			  return 8; /* callx12 */
-			}
-		      break;
-		    }
-		  break;
-		case 1:
-		  return 12; /* movsp */
-		case 2:
-		  if (Field_s_Slot_inst_get (insn) == 0)
-		    {
-		      switch (Field_t_Slot_inst_get (insn))
-			{
-			case 0:
-			  return 114; /* isync */
-			case 1:
-			  return 115; /* rsync */
-			case 2:
-			  return 116; /* esync */
-			case 3:
-			  return 117; /* dsync */
-			case 8:
-			  return 0; /* excw */
-			case 12:
-			  return 112; /* memw */
-			case 13:
-			  return 113; /* extw */
-			case 15:
-			  return 95; /* nop */
-			}
-		    }
-		  break;
-		case 3:
-		  switch (Field_t_Slot_inst_get (insn))
-		    {
-		    case 0:
-		      switch (Field_s_Slot_inst_get (insn))
-			{
-			case 0:
-			  return 1; /* rfe */
-			case 2:
-			  return 2; /* rfde */
-			case 4:
-			  return 16; /* rfwo */
-			case 5:
-			  return 17; /* rfwu */
-			}
-		      break;
-		    case 1:
-		      return 188; /* rfi */
-		    }
-		  break;
-		case 4:
-		  return 196; /* break */
-		case 5:
-		  switch (Field_s_Slot_inst_get (insn))
-		    {
-		    case 0:
-		      if (Field_t_Slot_inst_get (insn) == 0)
-			return 3; /* syscall */
-		      break;
-		    case 1:
-		      if (Field_t_Slot_inst_get (insn) == 0)
-			return 4; /* simcall */
-		      break;
-		    }
-		  break;
-		case 6:
-		  return 118; /* rsil */
-		case 7:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 189; /* waiti */
-		  break;
-		}
-	      break;
-	    case 1:
-	      return 47; /* and */
-	    case 2:
-	      return 48; /* or */
-	    case 3:
-	      return 49; /* xor */
-	    case 4:
-	      switch (Field_r_Slot_inst_get (insn))
-		{
-		case 0:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 100; /* ssr */
-		  break;
-		case 1:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 101; /* ssl */
-		  break;
-		case 2:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 102; /* ssa8l */
-		  break;
-		case 3:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 103; /* ssa8b */
-		  break;
-		case 4:
-		  if (Field_thi3_Slot_inst_get (insn) == 0)
-		    return 104; /* ssai */
-		  break;
-		case 8:
-		  if (Field_s_Slot_inst_get (insn) == 0)
-		    return 13; /* rotw */
-		  break;
-		case 14:
-		  return 274; /* nsa */
-		case 15:
-		  return 275; /* nsau */
-		}
-	      break;
-	    case 5:
-	      switch (Field_r_Slot_inst_get (insn))
-		{
-		case 3:
-		  return 271; /* ritlb0 */
-		case 4:
-		  return 269; /* iitlb */
-		case 5:
-		  return 270; /* pitlb */
-		case 6:
-		  return 273; /* witlb */
-		case 7:
-		  return 272; /* ritlb1 */
-		case 11:
-		  return 266; /* rdtlb0 */
-		case 12:
-		  return 264; /* idtlb */
-		case 13:
-		  return 265; /* pdtlb */
-		case 14:
-		  return 268; /* wdtlb */
-		case 15:
-		  return 267; /* rdtlb1 */
-		}
-	      break;
-	    case 6:
-	      switch (Field_s_Slot_inst_get (insn))
-		{
-		case 0:
-		  return 93; /* neg */
-		case 1:
-		  return 94; /* abs */
-		}
-	      break;
-	    case 8:
-	      return 39; /* add */
-	    case 9:
-	      return 41; /* addx2 */
-	    case 10:
-	      return 42; /* addx4 */
-	    case 11:
-	      return 43; /* addx8 */
-	    case 12:
-	      return 40; /* sub */
-	    case 13:
-	      return 44; /* subx2 */
-	    case 14:
-	      return 45; /* subx4 */
-	    case 15:
-	      return 46; /* subx8 */
-	    }
-	  break;
-	case 1:
-	  switch (Field_op2_Slot_inst_get (insn))
-	    {
-	    case 0:
-	    case 1:
-	      return 109; /* slli */
-	    case 2:
-	    case 3:
-	      return 110; /* srai */
-	    case 4:
-	      return 111; /* srli */
-	    case 6:
-	      switch (Field_sr_Slot_inst_get (insn))
-		{
-		case 0:
-		  return 127; /* xsr.lbeg */
-		case 1:
-		  return 121; /* xsr.lend */
-		case 2:
-		  return 124; /* xsr.lcount */
-		case 3:
-		  return 130; /* xsr.sar */
-		case 5:
-		  return 133; /* xsr.litbase */
-		case 72:
-		  return 22; /* xsr.windowbase */
-		case 73:
-		  return 25; /* xsr.windowstart */
-		case 96:
-		  return 218; /* xsr.ibreakenable */
-		case 104:
-		  return 230; /* xsr.ddr */
-		case 128:
-		  return 212; /* xsr.ibreaka0 */
-		case 129:
-		  return 215; /* xsr.ibreaka1 */
-		case 144:
-		  return 200; /* xsr.dbreaka0 */
-		case 145:
-		  return 206; /* xsr.dbreaka1 */
-		case 160:
-		  return 203; /* xsr.dbreakc0 */
-		case 161:
-		  return 209; /* xsr.dbreakc1 */
-		case 177:
-		  return 141; /* xsr.epc1 */
-		case 178:
-		  return 147; /* xsr.epc2 */
-		case 179:
-		  return 153; /* xsr.epc3 */
-		case 180:
-		  return 159; /* xsr.epc4 */
-		case 192:
-		  return 177; /* xsr.depc */
-		case 194:
-		  return 165; /* xsr.eps2 */
-		case 195:
-		  return 168; /* xsr.eps3 */
-		case 196:
-		  return 171; /* xsr.eps4 */
-		case 209:
-		  return 144; /* xsr.excsave1 */
-		case 210:
-		  return 150; /* xsr.excsave2 */
-		case 211:
-		  return 156; /* xsr.excsave3 */
-		case 212:
-		  return 162; /* xsr.excsave4 */
-		case 228:
-		  return 195; /* xsr.intenable */
-		case 230:
-		  return 138; /* xsr.ps */
-		case 232:
-		  return 180; /* xsr.exccause */
-		case 233:
-		  return 221; /* xsr.debugcause */
-		case 234:
-		  return 235; /* xsr.ccount */
-		case 236:
-		  return 224; /* xsr.icount */
-		case 237:
-		  return 227; /* xsr.icountlevel */
-		case 238:
-		  return 174; /* xsr.excvaddr */
-		case 240:
-		  return 238; /* xsr.ccompare0 */
-		case 241:
-		  return 241; /* xsr.ccompare1 */
-		case 242:
-		  return 244; /* xsr.ccompare2 */
-		case 244:
-		  return 183; /* xsr.misc0 */
-		case 245:
-		  return 186; /* xsr.misc1 */
-		}
-	      break;
-	    case 8:
-	      return 106; /* src */
-	    case 9:
-	      if (Field_s_Slot_inst_get (insn) == 0)
-		return 107; /* srl */
-	      break;
-	    case 10:
-	      if (Field_t_Slot_inst_get (insn) == 0)
-		return 105; /* sll */
-	      break;
-	    case 11:
-	      if (Field_s_Slot_inst_get (insn) == 0)
-		return 108; /* sra */
-	      break;
-	    case 15:
-	      switch (Field_r_Slot_inst_get (insn))
-		{
-		case 0:
-		  return 248; /* lict */
-		case 1:
-		  return 250; /* sict */
-		case 2:
-		  return 249; /* licw */
-		case 3:
-		  return 251; /* sicw */
-		case 8:
-		  return 263; /* ldct */
-		case 9:
-		  return 262; /* sdct */
-		case 14:
-		  if (Field_t_Slot_inst_get (insn) == 0)
-		    return 231; /* rfdo */
-		  if (Field_t_Slot_inst_get (insn) == 1)
-		    return 232; /* rfdd */
-		  break;
-		}
-	      break;
-	    }
-	  break;
-	case 3:
-	  switch (Field_op2_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      switch (Field_sr_Slot_inst_get (insn))
-		{
-		case 0:
-		  return 125; /* rsr.lbeg */
-		case 1:
-		  return 119; /* rsr.lend */
-		case 2:
-		  return 122; /* rsr.lcount */
-		case 3:
-		  return 128; /* rsr.sar */
-		case 5:
-		  return 131; /* rsr.litbase */
-		case 72:
-		  return 20; /* rsr.windowbase */
-		case 73:
-		  return 23; /* rsr.windowstart */
-		case 96:
-		  return 216; /* rsr.ibreakenable */
-		case 104:
-		  return 228; /* rsr.ddr */
-		case 128:
-		  return 210; /* rsr.ibreaka0 */
-		case 129:
-		  return 213; /* rsr.ibreaka1 */
-		case 144:
-		  return 198; /* rsr.dbreaka0 */
-		case 145:
-		  return 204; /* rsr.dbreaka1 */
-		case 160:
-		  return 201; /* rsr.dbreakc0 */
-		case 161:
-		  return 207; /* rsr.dbreakc1 */
-		case 176:
-		  return 134; /* rsr.176 */
-		case 177:
-		  return 139; /* rsr.epc1 */
-		case 178:
-		  return 145; /* rsr.epc2 */
-		case 179:
-		  return 151; /* rsr.epc3 */
-		case 180:
-		  return 157; /* rsr.epc4 */
-		case 192:
-		  return 175; /* rsr.depc */
-		case 194:
-		  return 163; /* rsr.eps2 */
-		case 195:
-		  return 166; /* rsr.eps3 */
-		case 196:
-		  return 169; /* rsr.eps4 */
-		case 208:
-		  return 135; /* rsr.208 */
-		case 209:
-		  return 142; /* rsr.excsave1 */
-		case 210:
-		  return 148; /* rsr.excsave2 */
-		case 211:
-		  return 154; /* rsr.excsave3 */
-		case 212:
-		  return 160; /* rsr.excsave4 */
-		case 226:
-		  return 190; /* rsr.interrupt */
-		case 228:
-		  return 193; /* rsr.intenable */
-		case 230:
-		  return 136; /* rsr.ps */
-		case 232:
-		  return 178; /* rsr.exccause */
-		case 233:
-		  return 219; /* rsr.debugcause */
-		case 234:
-		  return 233; /* rsr.ccount */
-		case 235:
-		  return 187; /* rsr.prid */
-		case 236:
-		  return 222; /* rsr.icount */
-		case 237:
-		  return 225; /* rsr.icountlevel */
-		case 238:
-		  return 172; /* rsr.excvaddr */
-		case 240:
-		  return 236; /* rsr.ccompare0 */
-		case 241:
-		  return 239; /* rsr.ccompare1 */
-		case 242:
-		  return 242; /* rsr.ccompare2 */
-		case 244:
-		  return 181; /* rsr.misc0 */
-		case 245:
-		  return 184; /* rsr.misc1 */
-		}
-	      break;
-	    case 1:
-	      switch (Field_sr_Slot_inst_get (insn))
-		{
-		case 0:
-		  return 126; /* wsr.lbeg */
-		case 1:
-		  return 120; /* wsr.lend */
-		case 2:
-		  return 123; /* wsr.lcount */
-		case 3:
-		  return 129; /* wsr.sar */
-		case 5:
-		  return 132; /* wsr.litbase */
-		case 72:
-		  return 21; /* wsr.windowbase */
-		case 73:
-		  return 24; /* wsr.windowstart */
-		case 96:
-		  return 217; /* wsr.ibreakenable */
-		case 104:
-		  return 229; /* wsr.ddr */
-		case 128:
-		  return 211; /* wsr.ibreaka0 */
-		case 129:
-		  return 214; /* wsr.ibreaka1 */
-		case 144:
-		  return 199; /* wsr.dbreaka0 */
-		case 145:
-		  return 205; /* wsr.dbreaka1 */
-		case 160:
-		  return 202; /* wsr.dbreakc0 */
-		case 161:
-		  return 208; /* wsr.dbreakc1 */
-		case 177:
-		  return 140; /* wsr.epc1 */
-		case 178:
-		  return 146; /* wsr.epc2 */
-		case 179:
-		  return 152; /* wsr.epc3 */
-		case 180:
-		  return 158; /* wsr.epc4 */
-		case 192:
-		  return 176; /* wsr.depc */
-		case 194:
-		  return 164; /* wsr.eps2 */
-		case 195:
-		  return 167; /* wsr.eps3 */
-		case 196:
-		  return 170; /* wsr.eps4 */
-		case 209:
-		  return 143; /* wsr.excsave1 */
-		case 210:
-		  return 149; /* wsr.excsave2 */
-		case 211:
-		  return 155; /* wsr.excsave3 */
-		case 212:
-		  return 161; /* wsr.excsave4 */
-		case 226:
-		  return 191; /* wsr.intset */
-		case 227:
-		  return 192; /* wsr.intclear */
-		case 228:
-		  return 194; /* wsr.intenable */
-		case 230:
-		  return 137; /* wsr.ps */
-		case 232:
-		  return 179; /* wsr.exccause */
-		case 233:
-		  return 220; /* wsr.debugcause */
-		case 234:
-		  return 234; /* wsr.ccount */
-		case 236:
-		  return 223; /* wsr.icount */
-		case 237:
-		  return 226; /* wsr.icountlevel */
-		case 238:
-		  return 173; /* wsr.excvaddr */
-		case 240:
-		  return 237; /* wsr.ccompare0 */
-		case 241:
-		  return 240; /* wsr.ccompare1 */
-		case 242:
-		  return 243; /* wsr.ccompare2 */
-		case 244:
-		  return 182; /* wsr.misc0 */
-		case 245:
-		  return 185; /* wsr.misc1 */
-		}
-	      break;
-	    case 8:
-	      return 89; /* moveqz */
-	    case 9:
-	      return 90; /* movnez */
-	    case 10:
-	      return 91; /* movltz */
-	    case 11:
-	      return 92; /* movgez */
-	    }
-	  break;
-	case 4:
-	case 5:
-	  return 76; /* extui */
-	case 9:
-	  switch (Field_op2_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      return 18; /* l32e */
-	    case 4:
-	      return 19; /* s32e */
-	    }
-	  break;
-	}
-      break;
-    case 1:
-      return 83; /* l32r */
-    case 2:
-      switch (Field_r_Slot_inst_get (insn))
-	{
-	case 0:
-	  return 84; /* l8ui */
-	case 1:
-	  return 80; /* l16ui */
-	case 2:
-	  return 82; /* l32i */
-	case 4:
-	  return 99; /* s8i */
-	case 5:
-	  return 97; /* s16i */
-	case 6:
-	  return 98; /* s32i */
-	case 7:
-	  switch (Field_t_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      return 258; /* dpfr */
-	    case 1:
-	      return 259; /* dpfw */
-	    case 2:
-	      return 260; /* dpfro */
-	    case 3:
-	      return 261; /* dpfwo */
-	    case 4:
-	      return 252; /* dhwb */
-	    case 5:
-	      return 253; /* dhwbi */
-	    case 6:
-	      return 256; /* dhi */
-	    case 7:
-	      return 257; /* dii */
-	    case 8:
-	      switch (Field_op1_Slot_inst_get (insn))
-		{
-		case 4:
-		  return 254; /* diwb */
-		case 5:
-		  return 255; /* diwbi */
-		}
-	      break;
-	    case 12:
-	      return 245; /* ipf */
-	    case 14:
-	      return 246; /* ihi */
-	    case 15:
-	      return 247; /* iii */
-	    }
-	  break;
-	case 9:
-	  return 81; /* l16si */
-	case 10:
-	  return 88; /* movi */
-	case 12:
-	  return 37; /* addi */
-	case 13:
-	  return 38; /* addmi */
-	}
-      break;
-    case 5:
-      switch (Field_n_Slot_inst_get (insn))
-	{
-	case 0:
-	  return 74; /* call0 */
-	case 1:
-	  return 7; /* call4 */
-	case 2:
-	  return 6; /* call8 */
-	case 3:
-	  return 5; /* call12 */
-	}
-      break;
-    case 6:
-      switch (Field_n_Slot_inst_get (insn))
-	{
-	case 0:
-	  return 78; /* j */
-	case 1:
-	  switch (Field_m_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      return 70; /* beqz */
-	    case 1:
-	      return 71; /* bnez */
-	    case 2:
-	      return 73; /* bltz */
-	    case 3:
-	      return 72; /* bgez */
-	    }
-	  break;
-	case 2:
-	  switch (Field_m_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      return 50; /* beqi */
-	    case 1:
-	      return 51; /* bnei */
-	    case 2:
-	      return 53; /* blti */
-	    case 3:
-	      return 52; /* bgei */
-	    }
-	  break;
-	case 3:
-	  switch (Field_m_Slot_inst_get (insn))
-	    {
-	    case 0:
-	      return 11; /* entry */
-	    case 1:
-	      switch (Field_r_Slot_inst_get (insn))
-		{
-		case 8:
-		  return 85; /* loop */
-		case 9:
-		  return 86; /* loopnez */
-		case 10:
-		  return 87; /* loopgtz */
-		}
-	      break;
-	    case 2:
-	      return 57; /* bltui */
-	    case 3:
-	      return 56; /* bgeui */
-	    }
-	  break;
-	}
-      break;
-    case 7:
-      switch (Field_r_Slot_inst_get (insn))
-	{
-	case 0:
-	  return 65; /* bnone */
-	case 1:
-	  return 58; /* beq */
-	case 2:
-	  return 61; /* blt */
-	case 3:
-	  return 63; /* bltu */
-	case 4:
-	  return 66; /* ball */
-	case 5:
-	  return 68; /* bbc */
-	case 6:
-	case 7:
-	  return 54; /* bbci */
-	case 8:
-	  return 64; /* bany */
-	case 9:
-	  return 59; /* bne */
-	case 10:
-	  return 60; /* bge */
-	case 11:
-	  return 62; /* bgeu */
-	case 12:
-	  return 67; /* bnall */
-	case 13:
-	  return 69; /* bbs */
-	case 14:
-	case 15:
-	  return 55; /* bbsi */
-	}
-      break;
-    }
-  return 0;
-}
-
-static int
-Slot_inst16b_decode (const xtensa_insnbuf insn)
-{
-  switch (Field_op0_Slot_inst16b_get (insn))
-    {
-    case 12:
-      switch (Field_i_Slot_inst16b_get (insn))
-	{
-	case 0:
-	  return 33; /* movi.n */
-	case 1:
-	  switch (Field_z_Slot_inst16b_get (insn))
-	    {
-	    case 0:
-	      return 28; /* beqz.n */
-	    case 1:
-	      return 29; /* bnez.n */
-	    }
-	  break;
-	}
-      break;
-    case 13:
-      switch (Field_r_Slot_inst16b_get (insn))
-	{
-	case 0:
-	  return 32; /* mov.n */
-	case 15:
-	  switch (Field_t_Slot_inst16b_get (insn))
-	    {
-	    case 0:
-	      return 35; /* ret.n */
-	    case 1:
-	      return 15; /* retw.n */
-	    case 2:
-	      return 197; /* break.n */
-	    case 3:
-	      if (Field_s_Slot_inst16b_get (insn) == 0)
-		return 34; /* nop.n */
-	      break;
-	    case 6:
-	      return 30; /* ill.n */
-	    }
-	  break;
-	}
-      break;
-    }
-  return 0;
-}
-
-static int
-Slot_inst16a_decode (const xtensa_insnbuf insn)
-{
-  switch (Field_op0_Slot_inst16a_get (insn))
-    {
-    case 8:
-      return 31; /* l32i.n */
-    case 9:
-      return 36; /* s32i.n */
-    case 10:
-      return 26; /* add.n */
-    case 11:
-      return 27; /* addi.n */
-    }
-  return 0;
-}
-
-
-/* Instruction slots.  */
-
-static void
-Slot_x24_Format_inst_0_get (const xtensa_insnbuf insn,
-			    xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = (insn[0] & 0xffffff);
-}
-
-static void
-Slot_x24_Format_inst_0_set (xtensa_insnbuf insn,
-			    const xtensa_insnbuf slotbuf)
-{
-  insn[0] = (insn[0] & ~0xffffff) | (slotbuf[0] & 0xffffff);
-}
-
-static void
-Slot_x16a_Format_inst16a_0_get (const xtensa_insnbuf insn,
-				xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = ((insn[0] & 0xffff00) >> 8);
-}
-
-static void
-Slot_x16a_Format_inst16a_0_set (xtensa_insnbuf insn,
-				const xtensa_insnbuf slotbuf)
-{
-  insn[0] = (insn[0] & ~0xffff00) | ((slotbuf[0] & 0xffff) << 8);
-}
-
-static void
-Slot_x16b_Format_inst16b_0_get (const xtensa_insnbuf insn,
-				xtensa_insnbuf slotbuf)
-{
-  slotbuf[0] = ((insn[0] & 0xffff00) >> 8);
-}
-
-static void
-Slot_x16b_Format_inst16b_0_set (xtensa_insnbuf insn,
-				const xtensa_insnbuf slotbuf)
-{
-  insn[0] = (insn[0] & ~0xffff00) | ((slotbuf[0] & 0xffff) << 8);
-}
-
-static xtensa_get_field_fn
-Slot_inst_get_field_fns[] = {
-  Field_t_Slot_inst_get,
-  Field_bbi4_Slot_inst_get,
-  Field_bbi_Slot_inst_get,
-  Field_imm12_Slot_inst_get,
-  Field_imm8_Slot_inst_get,
-  Field_s_Slot_inst_get,
-  Field_imm12b_Slot_inst_get,
-  Field_imm16_Slot_inst_get,
-  Field_m_Slot_inst_get,
-  Field_n_Slot_inst_get,
-  Field_offset_Slot_inst_get,
-  Field_op0_Slot_inst_get,
-  Field_op1_Slot_inst_get,
-  Field_op2_Slot_inst_get,
-  Field_r_Slot_inst_get,
-  Field_sa4_Slot_inst_get,
-  Field_sae4_Slot_inst_get,
-  Field_sae_Slot_inst_get,
-  Field_sal_Slot_inst_get,
-  Field_sargt_Slot_inst_get,
-  Field_sas4_Slot_inst_get,
-  Field_sas_Slot_inst_get,
-  Field_sr_Slot_inst_get,
-  Field_st_Slot_inst_get,
-  Field_thi3_Slot_inst_get,
-  Field_imm4_Slot_inst_get,
-  Field_mn_Slot_inst_get,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Implicit_Field_ar0_get,
-  Implicit_Field_ar4_get,
-  Implicit_Field_ar8_get,
-  Implicit_Field_ar12_get
-};
-
-static xtensa_set_field_fn
-Slot_inst_set_field_fns[] = {
-  Field_t_Slot_inst_set,
-  Field_bbi4_Slot_inst_set,
-  Field_bbi_Slot_inst_set,
-  Field_imm12_Slot_inst_set,
-  Field_imm8_Slot_inst_set,
-  Field_s_Slot_inst_set,
-  Field_imm12b_Slot_inst_set,
-  Field_imm16_Slot_inst_set,
-  Field_m_Slot_inst_set,
-  Field_n_Slot_inst_set,
-  Field_offset_Slot_inst_set,
-  Field_op0_Slot_inst_set,
-  Field_op1_Slot_inst_set,
-  Field_op2_Slot_inst_set,
-  Field_r_Slot_inst_set,
-  Field_sa4_Slot_inst_set,
-  Field_sae4_Slot_inst_set,
-  Field_sae_Slot_inst_set,
-  Field_sal_Slot_inst_set,
-  Field_sargt_Slot_inst_set,
-  Field_sas4_Slot_inst_set,
-  Field_sas_Slot_inst_set,
-  Field_sr_Slot_inst_set,
-  Field_st_Slot_inst_set,
-  Field_thi3_Slot_inst_set,
-  Field_imm4_Slot_inst_set,
-  Field_mn_Slot_inst_set,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set
-};
-
-static xtensa_get_field_fn
-Slot_inst16a_get_field_fns[] = {
-  Field_t_Slot_inst16a_get,
-  0,
-  0,
-  0,
-  0,
-  Field_s_Slot_inst16a_get,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_op0_Slot_inst16a_get,
-  0,
-  0,
-  Field_r_Slot_inst16a_get,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_sr_Slot_inst16a_get,
-  Field_st_Slot_inst16a_get,
-  0,
-  Field_imm4_Slot_inst16a_get,
-  0,
-  Field_i_Slot_inst16a_get,
-  Field_imm6lo_Slot_inst16a_get,
-  Field_imm6hi_Slot_inst16a_get,
-  Field_imm7lo_Slot_inst16a_get,
-  Field_imm7hi_Slot_inst16a_get,
-  Field_z_Slot_inst16a_get,
-  Field_imm6_Slot_inst16a_get,
-  Field_imm7_Slot_inst16a_get,
-  Implicit_Field_ar0_get,
-  Implicit_Field_ar4_get,
-  Implicit_Field_ar8_get,
-  Implicit_Field_ar12_get
-};
-
-static xtensa_set_field_fn
-Slot_inst16a_set_field_fns[] = {
-  Field_t_Slot_inst16a_set,
-  0,
-  0,
-  0,
-  0,
-  Field_s_Slot_inst16a_set,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_op0_Slot_inst16a_set,
-  0,
-  0,
-  Field_r_Slot_inst16a_set,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_sr_Slot_inst16a_set,
-  Field_st_Slot_inst16a_set,
-  0,
-  Field_imm4_Slot_inst16a_set,
-  0,
-  Field_i_Slot_inst16a_set,
-  Field_imm6lo_Slot_inst16a_set,
-  Field_imm6hi_Slot_inst16a_set,
-  Field_imm7lo_Slot_inst16a_set,
-  Field_imm7hi_Slot_inst16a_set,
-  Field_z_Slot_inst16a_set,
-  Field_imm6_Slot_inst16a_set,
-  Field_imm7_Slot_inst16a_set,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set
-};
-
-static xtensa_get_field_fn
-Slot_inst16b_get_field_fns[] = {
-  Field_t_Slot_inst16b_get,
-  0,
-  0,
-  0,
-  0,
-  Field_s_Slot_inst16b_get,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_op0_Slot_inst16b_get,
-  0,
-  0,
-  Field_r_Slot_inst16b_get,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_sr_Slot_inst16b_get,
-  Field_st_Slot_inst16b_get,
-  0,
-  Field_imm4_Slot_inst16b_get,
-  0,
-  Field_i_Slot_inst16b_get,
-  Field_imm6lo_Slot_inst16b_get,
-  Field_imm6hi_Slot_inst16b_get,
-  Field_imm7lo_Slot_inst16b_get,
-  Field_imm7hi_Slot_inst16b_get,
-  Field_z_Slot_inst16b_get,
-  Field_imm6_Slot_inst16b_get,
-  Field_imm7_Slot_inst16b_get,
-  Implicit_Field_ar0_get,
-  Implicit_Field_ar4_get,
-  Implicit_Field_ar8_get,
-  Implicit_Field_ar12_get
-};
-
-static xtensa_set_field_fn
-Slot_inst16b_set_field_fns[] = {
-  Field_t_Slot_inst16b_set,
-  0,
-  0,
-  0,
-  0,
-  Field_s_Slot_inst16b_set,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_op0_Slot_inst16b_set,
-  0,
-  0,
-  Field_r_Slot_inst16b_set,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  0,
-  Field_sr_Slot_inst16b_set,
-  Field_st_Slot_inst16b_set,
-  0,
-  Field_imm4_Slot_inst16b_set,
-  0,
-  Field_i_Slot_inst16b_set,
-  Field_imm6lo_Slot_inst16b_set,
-  Field_imm6hi_Slot_inst16b_set,
-  Field_imm7lo_Slot_inst16b_set,
-  Field_imm7hi_Slot_inst16b_set,
-  Field_z_Slot_inst16b_set,
-  Field_imm6_Slot_inst16b_set,
-  Field_imm7_Slot_inst16b_set,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set,
-  Implicit_Field_set
-};
-
-static xtensa_slot_internal slots[] = {
-  { "Inst", "x24", 0,
-    Slot_x24_Format_inst_0_get, Slot_x24_Format_inst_0_set,
-    Slot_inst_get_field_fns, Slot_inst_set_field_fns,
-    Slot_inst_decode, "nop" },
-  { "Inst16a", "x16a", 0,
-    Slot_x16a_Format_inst16a_0_get, Slot_x16a_Format_inst16a_0_set,
-    Slot_inst16a_get_field_fns, Slot_inst16a_set_field_fns,
-    Slot_inst16a_decode, "" },
-  { "Inst16b", "x16b", 0,
-    Slot_x16b_Format_inst16b_0_get, Slot_x16b_Format_inst16b_0_set,
-    Slot_inst16b_get_field_fns, Slot_inst16b_set_field_fns,
-    Slot_inst16b_decode, "nop.n" }
-};
-
-
-/* Instruction formats.  */
-
-static void
-Format_x24_encode (xtensa_insnbuf insn)
-{
-  insn[0] = 0;
-}
-
-static void
-Format_x16a_encode (xtensa_insnbuf insn)
-{
-  insn[0] = 0x800000;
-}
-
-static void
-Format_x16b_encode (xtensa_insnbuf insn)
-{
-  insn[0] = 0xc00000;
-}
-
-static int Format_x24_slots[] = { 0 };
-
-static int Format_x16a_slots[] = { 1 };
-
-static int Format_x16b_slots[] = { 2 };
-
-static xtensa_format_internal formats[] = {
-  { "x24", 3, Format_x24_encode, 1, Format_x24_slots },
-  { "x16a", 2, Format_x16a_encode, 1, Format_x16a_slots },
-  { "x16b", 2, Format_x16b_encode, 1, Format_x16b_slots }
-};
-
-
-static int
-format_decoder (const xtensa_insnbuf insn)
-{
-  if ((insn[0] & 0x800000) == 0)
-    return 0; /* x24 */
-  if ((insn[0] & 0xc00000) == 0x800000)
-    return 1; /* x16a */
-  if ((insn[0] & 0xe00000) == 0xc00000)
-    return 2; /* x16b */
-  return -1;
-}
-
-static int length_table[16] = {
-  3,
-  3,
-  3,
-  3,
-  3,
-  3,
-  3,
-  3,
+static const uint32 b4constu_table[] = {
+  32768,
+  65536,
   2,
-  2,
-  2,
-  2,
-  2,
-  2,
+  3,
+  4,
+  5,
+  6,
+  7,
+  8,
+  10,
+  12,
+  16,
+  32,
+  64,
+  128,
+  256
+};
+
+uint32
+decode_b4constu (uint32 val)
+{
+  val = b4constu_table[val];
+  return val;
+}
+
+xtensa_encode_result
+encode_b4constu (uint32 *valp)
+{
+  uint32 val = *valp;
+  unsigned i;
+  for (i = 0; i < (1 << 4); i += 1)
+    if (b4constu_table[i] == val) goto found;
+  return xtensa_encode_result_not_in_table;
+ found:
+  val = i;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm8x256 (uint32 val)
+{
+  val = (val ^ 0x80) - 0x80;
+  val <<= 8;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm8x256 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 8) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 8;
+  if (((val + (1 << 7)) >> 8) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_soffset (uint32 val)
+{
+  val = (val ^ 0x20000) - 0x20000;
+  return val;
+}
+
+xtensa_encode_result
+encode_soffset (uint32 *valp)
+{
+  uint32 val = *valp;
+  if (((val + (1 << 17)) >> 18) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm4 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op0 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_op0 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op1 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_op1 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm6 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 6) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op2 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_op2 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm7 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 7) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm4 (uint32 val)
+{
+  val = (val ^ 0x8) - 0x8;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if (((val + (1 << 3)) >> 4) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+static const uint32 ai4const_table[] = {
   -1,
-  -1
+  1,
+  2,
+  3,
+  4,
+  5,
+  6,
+  7,
+  8,
+  9,
+  10,
+  11,
+  12,
+  13,
+  14,
+  15
 };
 
-static int
-length_decoder (const char *insn)
+uint32
+decode_ai4const (uint32 val)
 {
-  int op0 = (insn[0] >> 4) & 0xf;
-  return length_table[op0];
+  val = ai4const_table[val];
+  return val;
 }
 
-
-/* Top-level ISA structure.  */
+xtensa_encode_result
+encode_ai4const (uint32 *valp)
+{
+  uint32 val = *valp;
+  unsigned i;
+  for (i = 0; i < (1 << 4); i += 1)
+    if (ai4const_table[i] == val) goto found;
+  return xtensa_encode_result_not_in_table;
+ found:
+  val = i;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
 
-xtensa_isa_internal xtensa_modules = {
-  1 /* big-endian */,
-  3 /* insn_size */, 0,
-  3, formats, format_decoder, length_decoder,
-  3, slots,
-  39 /* num_fields */,
-  70, operands,
-  220, iclasses,
-  276, opcodes, 0,
-  1, regfiles,
-  NUM_STATES, states, 0,
-  NUM_SYSREGS, sysregs, 0,
-  { MAX_SPECIAL_REG, MAX_USER_REG }, { 0, 0 },
-  0, interfaces, 0,
-  0, funcUnits, 0
+uint32
+decode_imm8 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm8 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 8) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sae (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sae (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 5) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7lo (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm7lo (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm7 (uint32 val)
+{
+  if (val > 95)
+      val |= -32;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm7 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((signed int) val < -32)
+    return xtensa_encode_result_too_low;
+  if ((signed int) val > 95)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm8 (uint32 val)
+{
+  val = (val ^ 0x80) - 0x80;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm8 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if (((val + (1 << 7)) >> 8) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm12x8 (uint32 val)
+{
+  val <<= 3;
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm12x8 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 3) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 3;
+  if ((val >> 12) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sal (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sal (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 5) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm6 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm6 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 6) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sas4 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sas4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm8 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 8) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm16x4 (uint32 val)
+{
+  val |= -1 << 16;
+  val <<= 2;
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm16x4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 2) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 2;
+  if ((signed int) val >> 16 != -1)
+    {
+      if ((signed int) val >= 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sar (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sar (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 5) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sa4 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sa4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sas (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sas (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 5) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6hi (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm6hi (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 2) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_bbi (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_bbi (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 5) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8x2 (uint32 val)
+{
+  val <<= 1;
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm8x2 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 1) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 1;
+  if ((val >> 8) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8x4 (uint32 val)
+{
+  val <<= 2;
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm8x4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 2) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 2;
+  if ((val >> 8) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+static const uint32 mip32const_table[] = {
+  32,
+  31,
+  30,
+  29,
+  28,
+  27,
+  26,
+  25,
+  24,
+  23,
+  22,
+  21,
+  20,
+  19,
+  18,
+  17,
+  16,
+  15,
+  14,
+  13,
+  12,
+  11,
+  10,
+  9,
+  8,
+  7,
+  6,
+  5,
+  4,
+  3,
+  2,
+  1
+};
+
+uint32
+decode_msalp32 (uint32 val)
+{
+  val = mip32const_table[val];
+  return val;
+}
+
+xtensa_encode_result
+encode_msalp32 (uint32 *valp)
+{
+  uint32 val = *valp;
+  unsigned i;
+  for (i = 0; i < (1 << 5); i += 1)
+    if (mip32const_table[i] == val) goto found;
+  return xtensa_encode_result_not_in_table;
+ found:
+  val = i;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_bbi4 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_bbi4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+static const uint32 i4p1const_table[] = {
+  1,
+  2,
+  3,
+  4,
+  5,
+  6,
+  7,
+  8,
+  9,
+  10,
+  11,
+  12,
+  13,
+  14,
+  15,
+  16
+};
+
+uint32
+decode_op2p1 (uint32 val)
+{
+  val = i4p1const_table[val];
+  return val;
+}
+
+xtensa_encode_result
+encode_op2p1 (uint32 *valp)
+{
+  uint32 val = *valp;
+  unsigned i;
+  for (i = 0; i < (1 << 4); i += 1)
+    if (i4p1const_table[i] == val) goto found;
+  return xtensa_encode_result_not_in_table;
+ found:
+  val = i;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_soffsetx4 (uint32 val)
+{
+  val = (val ^ 0x20000) - 0x20000;
+  val <<= 2;
+  return val;
+}
+
+xtensa_encode_result
+encode_soffsetx4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 2) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 2;
+  if (((val + (1 << 17)) >> 18) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6lo (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm6lo (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm12 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm12 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 12) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+static const uint32 b4const_table[] = {
+  -1,
+  1,
+  2,
+  3,
+  4,
+  5,
+  6,
+  7,
+  8,
+  10,
+  12,
+  16,
+  32,
+  64,
+  128,
+  256
+};
+
+uint32
+decode_b4const (uint32 val)
+{
+  val = b4const_table[val];
+  return val;
+}
+
+xtensa_encode_result
+encode_b4const (uint32 *valp)
+{
+  uint32 val = *valp;
+  unsigned i;
+  for (i = 0; i < (1 << 4); i += 1)
+    if (b4const_table[i] == val) goto found;
+  return xtensa_encode_result_not_in_table;
+ found:
+  val = i;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_i (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_i (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm16 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm16 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 16) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_mn (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_mn (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_m (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_m (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 2) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_n (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_n (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 2) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_none (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_none (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 0) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm12b (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm12b (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 12) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_r (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_r (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_s (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_s (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_t (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_t (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_thi3 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_thi3 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 3) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sae4 (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sae4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_offset (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_offset (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 18) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7hi (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_imm7hi (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 3) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm4x16 (uint32 val)
+{
+  val <<= 4;
+  return val;
+}
+
+xtensa_encode_result
+encode_uimm4x16 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 4) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 4;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm12b (uint32 val)
+{
+  val = (val ^ 0x800) - 0x800;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm12b (uint32 *valp)
+{
+  uint32 val = *valp;
+  if (((val + (1 << 11)) >> 12) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_lsi4x4 (uint32 val)
+{
+  val <<= 2;
+  return val;
+}
+
+xtensa_encode_result
+encode_lsi4x4 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 2) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 2;
+  if ((val >> 4) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_z (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_z (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 1) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm12 (uint32 val)
+{
+  val = (val ^ 0x800) - 0x800;
+  return val;
+}
+
+xtensa_encode_result
+encode_simm12 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if (((val + (1 << 11)) >> 12) != 0)
+    {
+      if ((signed int) val > 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sr (uint32 val)
+{
+  return val;
+}
+
+xtensa_encode_result
+encode_sr (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val >> 8) != 0)
+    return xtensa_encode_result_too_high;
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+uint32
+decode_nimm4x2 (uint32 val)
+{
+  val |= -1 << 4;
+  val <<= 2;
+  return val;
+}
+
+xtensa_encode_result
+encode_nimm4x2 (uint32 *valp)
+{
+  uint32 val = *valp;
+  if ((val & ((1 << 2) - 1)) != 0)
+    return xtensa_encode_result_align;
+  val = (signed int) val >> 2;
+  if ((signed int) val >> 4 != -1)
+    {
+      if ((signed int) val >= 0)
+        return xtensa_encode_result_too_high;
+      else
+        return xtensa_encode_result_too_low;
+    }
+  *valp = val;
+  return xtensa_encode_result_ok;
+}
+
+
+
+uint32 do_reloc_l (uint32, uint32);
+uint32 undo_reloc_l (uint32, uint32);
+uint32 do_reloc_L (uint32, uint32);
+uint32 undo_reloc_L (uint32, uint32);
+uint32 do_reloc_r (uint32, uint32);
+uint32 undo_reloc_r (uint32, uint32);
+
+
+uint32
+do_reloc_l (uint32 addr, uint32 pc)
+{
+  return addr - pc - 4;
+}
+
+uint32
+undo_reloc_l (uint32 offset, uint32 pc)
+{
+  return pc + offset + 4;
+}
+
+uint32
+do_reloc_L (uint32 addr, uint32 pc)
+{
+  return addr - (pc & -4) - 4;
+}
+
+uint32
+undo_reloc_L (uint32 offset, uint32 pc)
+{
+  return (pc & -4) + offset + 4;
+}
+
+uint32
+do_reloc_r (uint32 addr, uint32 pc)
+{
+  return addr - ((pc+3) & -4);
+}
+
+uint32
+undo_reloc_r (uint32 offset, uint32 pc)
+{
+  return ((pc+3) & -4) + offset;
+}
+
+static xtensa_operand_internal iib4const_operand = {
+  "i",
+  '<',
+  0,
+  get_r_field,
+  set_r_field,
+  encode_b4const,
+  decode_b4const,
+  0,
+  0
+};
+
+static xtensa_operand_internal iiuimm8_operand = {
+  "i",
+  '<',
+  0,
+  get_imm8_field,
+  set_imm8_field,
+  encode_uimm8,
+  decode_uimm8,
+  0,
+  0
+};
+
+static xtensa_operand_internal lisoffsetx4_operand = {
+  "L",
+  '<',
+  1,
+  get_offset_field,
+  set_offset_field,
+  encode_soffsetx4,
+  decode_soffsetx4,
+  do_reloc_L,
+  undo_reloc_L,
+};
+
+static xtensa_operand_internal iisimm8x256_operand = {
+  "i",
+  '<',
+  0,
+  get_imm8_field,
+  set_imm8_field,
+  encode_simm8x256,
+  decode_simm8x256,
+  0,
+  0
+};
+
+static xtensa_operand_internal lisimm12_operand = {
+  "l",
+  '<',
+  1,
+  get_imm12_field,
+  set_imm12_field,
+  encode_simm12,
+  decode_simm12,
+  do_reloc_l,
+  undo_reloc_l,
+};
+
+static xtensa_operand_internal iiop2p1_operand = {
+  "i",
+  '<',
+  0,
+  get_op2_field,
+  set_op2_field,
+  encode_op2p1,
+  decode_op2p1,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisae_operand = {
+  "i",
+  '<',
+  0,
+  get_sae_field,
+  set_sae_field,
+  encode_sae,
+  decode_sae,
+  0,
+  0
+};
+
+static xtensa_operand_internal iis_operand = {
+  "i",
+  '<',
+  0,
+  get_s_field,
+  set_s_field,
+  encode_s,
+  decode_s,
+  0,
+  0
+};
+
+static xtensa_operand_internal iit_operand = {
+  "i",
+  '<',
+  0,
+  get_t_field,
+  set_t_field,
+  encode_t,
+  decode_t,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisimm12b_operand = {
+  "i",
+  '<',
+  0,
+  get_imm12b_field,
+  set_imm12b_field,
+  encode_simm12b,
+  decode_simm12b,
+  0,
+  0
+};
+
+static xtensa_operand_internal iinimm4x2_operand = {
+  "i",
+  '<',
+  0,
+  get_imm4_field,
+  set_imm4_field,
+  encode_nimm4x2,
+  decode_nimm4x2,
+  0,
+  0
+};
+
+static xtensa_operand_internal iiuimm4x16_operand = {
+  "i",
+  '<',
+  0,
+  get_op2_field,
+  set_op2_field,
+  encode_uimm4x16,
+  decode_uimm4x16,
+  0,
+  0
+};
+
+static xtensa_operand_internal abs_operand = {
+  "a",
+  '=',
+  0,
+  get_s_field,
+  set_s_field,
+  encode_s,
+  decode_s,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisar_operand = {
+  "i",
+  '<',
+  0,
+  get_sar_field,
+  set_sar_field,
+  encode_sar,
+  decode_sar,
+  0,
+  0
+};
+
+static xtensa_operand_internal abt_operand = {
+  "a",
+  '=',
+  0,
+  get_t_field,
+  set_t_field,
+  encode_t,
+  decode_t,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisas_operand = {
+  "i",
+  '<',
+  0,
+  get_sas_field,
+  set_sas_field,
+  encode_sas,
+  decode_sas,
+  0,
+  0
+};
+
+static xtensa_operand_internal amr_operand = {
+  "a",
+  '=',
+  0,
+  get_r_field,
+  set_r_field,
+  encode_r,
+  decode_r,
+  0,
+  0
+};
+
+static xtensa_operand_internal iib4constu_operand = {
+  "i",
+  '<',
+  0,
+  get_r_field,
+  set_r_field,
+  encode_b4constu,
+  decode_b4constu,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisr_operand = {
+  "i",
+  '<',
+  0,
+  get_sr_field,
+  set_sr_field,
+  encode_sr,
+  decode_sr,
+  0,
+  0
+};
+
+static xtensa_operand_internal iibbi_operand = {
+  "i",
+  '<',
+  0,
+  get_bbi_field,
+  set_bbi_field,
+  encode_bbi,
+  decode_bbi,
+  0,
+  0
+};
+
+static xtensa_operand_internal iiai4const_operand = {
+  "i",
+  '<',
+  0,
+  get_t_field,
+  set_t_field,
+  encode_ai4const,
+  decode_ai4const,
+  0,
+  0
+};
+
+static xtensa_operand_internal iiuimm12x8_operand = {
+  "i",
+  '<',
+  0,
+  get_imm12_field,
+  set_imm12_field,
+  encode_uimm12x8,
+  decode_uimm12x8,
+  0,
+  0
+};
+
+static xtensa_operand_internal riuimm16x4_operand = {
+  "r",
+  '<',
+  1,
+  get_imm16_field,
+  set_imm16_field,
+  encode_uimm16x4,
+  decode_uimm16x4,
+  do_reloc_r,
+  undo_reloc_r,
+};
+
+static xtensa_operand_internal lisimm8_operand = {
+  "l",
+  '<',
+  1,
+  get_imm8_field,
+  set_imm8_field,
+  encode_simm8,
+  decode_simm8,
+  do_reloc_l,
+  undo_reloc_l,
+};
+
+static xtensa_operand_internal iilsi4x4_operand = {
+  "i",
+  '<',
+  0,
+  get_r_field,
+  set_r_field,
+  encode_lsi4x4,
+  decode_lsi4x4,
+  0,
+  0
+};
+
+static xtensa_operand_internal iiuimm8x2_operand = {
+  "i",
+  '<',
+  0,
+  get_imm8_field,
+  set_imm8_field,
+  encode_uimm8x2,
+  decode_uimm8x2,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisimm4_operand = {
+  "i",
+  '<',
+  0,
+  get_mn_field,
+  set_mn_field,
+  encode_simm4,
+  decode_simm4,
+  0,
+  0
+};
+
+static xtensa_operand_internal iimsalp32_operand = {
+  "i",
+  '<',
+  0,
+  get_sal_field,
+  set_sal_field,
+  encode_msalp32,
+  decode_msalp32,
+  0,
+  0
+};
+
+static xtensa_operand_internal liuimm6_operand = {
+  "l",
+  '<',
+  1,
+  get_imm6_field,
+  set_imm6_field,
+  encode_uimm6,
+  decode_uimm6,
+  do_reloc_l,
+  undo_reloc_l,
+};
+
+static xtensa_operand_internal iiuimm8x4_operand = {
+  "i",
+  '<',
+  0,
+  get_imm8_field,
+  set_imm8_field,
+  encode_uimm8x4,
+  decode_uimm8x4,
+  0,
+  0
+};
+
+static xtensa_operand_internal lisoffset_operand = {
+  "l",
+  '<',
+  1,
+  get_offset_field,
+  set_offset_field,
+  encode_soffset,
+  decode_soffset,
+  do_reloc_l,
+  undo_reloc_l,
+};
+
+static xtensa_operand_internal iisimm7_operand = {
+  "i",
+  '<',
+  0,
+  get_imm7_field,
+  set_imm7_field,
+  encode_simm7,
+  decode_simm7,
+  0,
+  0
+};
+
+static xtensa_operand_internal ais_operand = {
+  "a",
+  '<',
+  0,
+  get_s_field,
+  set_s_field,
+  encode_s,
+  decode_s,
+  0,
+  0
+};
+
+static xtensa_operand_internal liuimm8_operand = {
+  "l",
+  '<',
+  1,
+  get_imm8_field,
+  set_imm8_field,
+  encode_uimm8,
+  decode_uimm8,
+  do_reloc_l,
+  undo_reloc_l,
+};
+
+static xtensa_operand_internal ait_operand = {
+  "a",
+  '<',
+  0,
+  get_t_field,
+  set_t_field,
+  encode_t,
+  decode_t,
+  0,
+  0
+};
+
+static xtensa_operand_internal iisimm8_operand = {
+  "i",
+  '<',
+  0,
+  get_imm8_field,
+  set_imm8_field,
+  encode_simm8,
+  decode_simm8,
+  0,
+  0
+};
+
+static xtensa_operand_internal aor_operand = {
+  "a",
+  '>',
+  0,
+  get_r_field,
+  set_r_field,
+  encode_r,
+  decode_r,
+  0,
+  0
+};
+
+static xtensa_operand_internal aos_operand = {
+  "a",
+  '>',
+  0,
+  get_s_field,
+  set_s_field,
+  encode_s,
+  decode_s,
+  0,
+  0
+};
+
+static xtensa_operand_internal aot_operand = {
+  "a",
+  '>',
+  0,
+  get_t_field,
+  set_t_field,
+  encode_t,
+  decode_t,
+  0,
+  0
+};
+
+static xtensa_iclass_internal nopn_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *movi_operand_list[] = {
+  &aot_operand,
+  &iisimm12b_operand
+};
+
+static xtensa_iclass_internal movi_iclass = {
+  2,
+  &movi_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8u_operand_list[] = {
+  &ais_operand,
+  &iib4constu_operand,
+  &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8u_iclass = {
+  3,
+  &bsi8u_operand_list[0]
+};
+
+static xtensa_operand_internal *itlb_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal itlb_iclass = {
+  1,
+  &itlb_operand_list[0]
+};
+
+static xtensa_operand_internal *shiftst_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal shiftst_iclass = {
+  3,
+  &shiftst_operand_list[0]
+};
+
+static xtensa_operand_internal *l32r_operand_list[] = {
+  &aot_operand,
+  &riuimm16x4_operand
+};
+
+static xtensa_iclass_internal l32r_iclass = {
+  2,
+  &l32r_operand_list[0]
+};
+
+static xtensa_iclass_internal rfe_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *wait_operand_list[] = {
+  &iis_operand
+};
+
+static xtensa_iclass_internal wait_iclass = {
+  1,
+  &wait_operand_list[0]
+};
+
+static xtensa_operand_internal *rfi_operand_list[] = {
+  &iis_operand
+};
+
+static xtensa_iclass_internal rfi_iclass = {
+  1,
+  &rfi_operand_list[0]
+};
+
+static xtensa_operand_internal *movz_operand_list[] = {
+  &amr_operand,
+  &ais_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal movz_iclass = {
+  3,
+  &movz_operand_list[0]
+};
+
+static xtensa_operand_internal *callx_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal callx_iclass = {
+  1,
+  &callx_operand_list[0]
+};
+
+static xtensa_operand_internal *mov_n_operand_list[] = {
+  &aot_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal mov_n_iclass = {
+  2,
+  &mov_n_operand_list[0]
+};
+
+static xtensa_operand_internal *loadi4_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iilsi4x4_operand
+};
+
+static xtensa_iclass_internal loadi4_iclass = {
+  3,
+  &loadi4_operand_list[0]
+};
+
+static xtensa_operand_internal *exti_operand_list[] = {
+  &aor_operand,
+  &ait_operand,
+  &iisae_operand,
+  &iiop2p1_operand
+};
+
+static xtensa_iclass_internal exti_iclass = {
+  4,
+  &exti_operand_list[0]
+};
+
+static xtensa_operand_internal *break_operand_list[] = {
+  &iis_operand,
+  &iit_operand
+};
+
+static xtensa_iclass_internal break_iclass = {
+  2,
+  &break_operand_list[0]
+};
+
+static xtensa_operand_internal *slli_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &iimsalp32_operand
+};
+
+static xtensa_iclass_internal slli_iclass = {
+  3,
+  &slli_operand_list[0]
+};
+
+static xtensa_operand_internal *s16i_operand_list[] = {
+  &ait_operand,
+  &ais_operand,
+  &iiuimm8x2_operand
+};
+
+static xtensa_iclass_internal s16i_iclass = {
+  3,
+  &s16i_operand_list[0]
+};
+
+static xtensa_operand_internal *call_operand_list[] = {
+  &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call_iclass = {
+  1,
+  &call_operand_list[0]
+};
+
+static xtensa_operand_internal *shifts_operand_list[] = {
+  &aor_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal shifts_iclass = {
+  2,
+  &shifts_operand_list[0]
+};
+
+static xtensa_operand_internal *shiftt_operand_list[] = {
+  &aor_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal shiftt_iclass = {
+  2,
+  &shiftt_operand_list[0]
+};
+
+static xtensa_operand_internal *rotw_operand_list[] = {
+  &iisimm4_operand
+};
+
+static xtensa_iclass_internal rotw_iclass = {
+  1,
+  &rotw_operand_list[0]
+};
+
+static xtensa_operand_internal *addsub_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal addsub_iclass = {
+  3,
+  &addsub_operand_list[0]
+};
+
+static xtensa_operand_internal *l8i_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iiuimm8_operand
+};
+
+static xtensa_iclass_internal l8i_iclass = {
+  3,
+  &l8i_operand_list[0]
+};
+
+static xtensa_operand_internal *sari_operand_list[] = {
+  &iisas_operand
+};
+
+static xtensa_iclass_internal sari_iclass = {
+  1,
+  &sari_operand_list[0]
+};
+
+static xtensa_operand_internal *xsr_operand_list[] = {
+  &abt_operand,
+  &iisr_operand
+};
+
+static xtensa_iclass_internal xsr_iclass = {
+  2,
+  &xsr_operand_list[0]
+};
+
+static xtensa_operand_internal *rsil_operand_list[] = {
+  &aot_operand,
+  &iis_operand
+};
+
+static xtensa_iclass_internal rsil_iclass = {
+  2,
+  &rsil_operand_list[0]
+};
+
+static xtensa_operand_internal *bst8_operand_list[] = {
+  &ais_operand,
+  &ait_operand,
+  &lisimm8_operand
+};
+
+static xtensa_iclass_internal bst8_iclass = {
+  3,
+  &bst8_operand_list[0]
+};
+
+static xtensa_operand_internal *addi_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iisimm8_operand
+};
+
+static xtensa_iclass_internal addi_iclass = {
+  3,
+  &addi_operand_list[0]
+};
+
+static xtensa_operand_internal *callx12_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal callx12_iclass = {
+  1,
+  &callx12_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8_operand_list[] = {
+  &ais_operand,
+  &iib4const_operand,
+  &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8_iclass = {
+  3,
+  &bsi8_operand_list[0]
+};
+
+static xtensa_operand_internal *jumpx_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal jumpx_iclass = {
+  1,
+  &jumpx_operand_list[0]
+};
+
+static xtensa_iclass_internal retn_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *nsa_operand_list[] = {
+  &aot_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal nsa_iclass = {
+  2,
+  &nsa_operand_list[0]
+};
+
+static xtensa_operand_internal *storei4_operand_list[] = {
+  &ait_operand,
+  &ais_operand,
+  &iilsi4x4_operand
+};
+
+static xtensa_iclass_internal storei4_iclass = {
+  3,
+  &storei4_operand_list[0]
+};
+
+static xtensa_operand_internal *wtlb_operand_list[] = {
+  &ait_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal wtlb_iclass = {
+  2,
+  &wtlb_operand_list[0]
+};
+
+static xtensa_operand_internal *dce_operand_list[] = {
+  &ais_operand,
+  &iiuimm4x16_operand
+};
+
+static xtensa_iclass_internal dce_iclass = {
+  2,
+  &dce_operand_list[0]
+};
+
+static xtensa_operand_internal *l16i_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iiuimm8x2_operand
+};
+
+static xtensa_iclass_internal l16i_iclass = {
+  3,
+  &l16i_operand_list[0]
+};
+
+static xtensa_operand_internal *callx4_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal callx4_iclass = {
+  1,
+  &callx4_operand_list[0]
+};
+
+static xtensa_operand_internal *callx8_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal callx8_iclass = {
+  1,
+  &callx8_operand_list[0]
+};
+
+static xtensa_operand_internal *movsp_operand_list[] = {
+  &aot_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal movsp_iclass = {
+  2,
+  &movsp_operand_list[0]
+};
+
+static xtensa_operand_internal *wsr_operand_list[] = {
+  &ait_operand,
+  &iisr_operand
+};
+
+static xtensa_iclass_internal wsr_iclass = {
+  2,
+  &wsr_operand_list[0]
+};
+
+static xtensa_operand_internal *call12_operand_list[] = {
+  &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call12_iclass = {
+  1,
+  &call12_operand_list[0]
+};
+
+static xtensa_operand_internal *call4_operand_list[] = {
+  &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call4_iclass = {
+  1,
+  &call4_operand_list[0]
+};
+
+static xtensa_operand_internal *addmi_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iisimm8x256_operand
+};
+
+static xtensa_iclass_internal addmi_iclass = {
+  3,
+  &addmi_operand_list[0]
+};
+
+static xtensa_operand_internal *bit_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal bit_iclass = {
+  3,
+  &bit_operand_list[0]
+};
+
+static xtensa_operand_internal *call8_operand_list[] = {
+  &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call8_iclass = {
+  1,
+  &call8_operand_list[0]
+};
+
+static xtensa_iclass_internal itlba_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *break_n_operand_list[] = {
+  &iis_operand
+};
+
+static xtensa_iclass_internal break_n_iclass = {
+  1,
+  &break_n_operand_list[0]
+};
+
+static xtensa_operand_internal *sar_operand_list[] = {
+  &ais_operand
+};
+
+static xtensa_iclass_internal sar_iclass = {
+  1,
+  &sar_operand_list[0]
+};
+
+static xtensa_operand_internal *s32e_operand_list[] = {
+  &ait_operand,
+  &ais_operand,
+  &iinimm4x2_operand
+};
+
+static xtensa_iclass_internal s32e_iclass = {
+  3,
+  &s32e_operand_list[0]
+};
+
+static xtensa_operand_internal *bz6_operand_list[] = {
+  &ais_operand,
+  &liuimm6_operand
+};
+
+static xtensa_iclass_internal bz6_iclass = {
+  2,
+  &bz6_operand_list[0]
+};
+
+static xtensa_operand_internal *loop_operand_list[] = {
+  &ais_operand,
+  &liuimm8_operand
+};
+
+static xtensa_iclass_internal loop_iclass = {
+  2,
+  &loop_operand_list[0]
+};
+
+static xtensa_operand_internal *rsr_operand_list[] = {
+  &aot_operand,
+  &iisr_operand
+};
+
+static xtensa_iclass_internal rsr_iclass = {
+  2,
+  &rsr_operand_list[0]
+};
+
+static xtensa_operand_internal *icache_operand_list[] = {
+  &ais_operand,
+  &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal icache_iclass = {
+  2,
+  &icache_operand_list[0]
+};
+
+static xtensa_operand_internal *s8i_operand_list[] = {
+  &ait_operand,
+  &ais_operand,
+  &iiuimm8_operand
+};
+
+static xtensa_iclass_internal s8i_iclass = {
+  3,
+  &s8i_operand_list[0]
+};
+
+static xtensa_iclass_internal return_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *dcache_operand_list[] = {
+  &ais_operand,
+  &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal dcache_iclass = {
+  2,
+  &dcache_operand_list[0]
+};
+
+static xtensa_operand_internal *s32i_operand_list[] = {
+  &ait_operand,
+  &ais_operand,
+  &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal s32i_iclass = {
+  3,
+  &s32i_operand_list[0]
+};
+
+static xtensa_operand_internal *jump_operand_list[] = {
+  &lisoffset_operand
+};
+
+static xtensa_iclass_internal jump_iclass = {
+  1,
+  &jump_operand_list[0]
+};
+
+static xtensa_operand_internal *addi_n_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &iiai4const_operand
+};
+
+static xtensa_iclass_internal addi_n_iclass = {
+  3,
+  &addi_n_operand_list[0]
+};
+
+static xtensa_iclass_internal sync_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *neg_operand_list[] = {
+  &aor_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal neg_iclass = {
+  2,
+  &neg_operand_list[0]
+};
+
+static xtensa_iclass_internal syscall_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *bsz12_operand_list[] = {
+  &ais_operand,
+  &lisimm12_operand
+};
+
+static xtensa_iclass_internal bsz12_iclass = {
+  2,
+  &bsz12_operand_list[0]
+};
+
+static xtensa_iclass_internal excw_iclass = {
+  0,
+  0
+};
+
+static xtensa_operand_internal *movi_n_operand_list[] = {
+  &aos_operand,
+  &iisimm7_operand
+};
+
+static xtensa_iclass_internal movi_n_iclass = {
+  2,
+  &movi_n_operand_list[0]
+};
+
+static xtensa_operand_internal *rtlb_operand_list[] = {
+  &aot_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal rtlb_iclass = {
+  2,
+  &rtlb_operand_list[0]
+};
+
+static xtensa_operand_internal *actl_operand_list[] = {
+  &aot_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal actl_iclass = {
+  2,
+  &actl_operand_list[0]
+};
+
+static xtensa_operand_internal *srli_operand_list[] = {
+  &aor_operand,
+  &ait_operand,
+  &iis_operand
+};
+
+static xtensa_iclass_internal srli_iclass = {
+  3,
+  &srli_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8b_operand_list[] = {
+  &ais_operand,
+  &iibbi_operand,
+  &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8b_iclass = {
+  3,
+  &bsi8b_operand_list[0]
+};
+
+static xtensa_operand_internal *acts_operand_list[] = {
+  &ait_operand,
+  &ais_operand
+};
+
+static xtensa_iclass_internal acts_iclass = {
+  2,
+  &acts_operand_list[0]
+};
+
+static xtensa_operand_internal *add_n_operand_list[] = {
+  &aor_operand,
+  &ais_operand,
+  &ait_operand
+};
+
+static xtensa_iclass_internal add_n_iclass = {
+  3,
+  &add_n_operand_list[0]
+};
+
+static xtensa_operand_internal *srai_operand_list[] = {
+  &aor_operand,
+  &ait_operand,
+  &iisar_operand
+};
+
+static xtensa_iclass_internal srai_iclass = {
+  3,
+  &srai_operand_list[0]
+};
+
+static xtensa_operand_internal *entry_operand_list[] = {
+  &abs_operand,
+  &iiuimm12x8_operand
+};
+
+static xtensa_iclass_internal entry_iclass = {
+  2,
+  &entry_operand_list[0]
+};
+
+static xtensa_operand_internal *l32e_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iinimm4x2_operand
+};
+
+static xtensa_iclass_internal l32e_iclass = {
+  3,
+  &l32e_operand_list[0]
+};
+
+static xtensa_operand_internal *dpf_operand_list[] = {
+  &ais_operand,
+  &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal dpf_iclass = {
+  2,
+  &dpf_operand_list[0]
+};
+
+static xtensa_operand_internal *l32i_operand_list[] = {
+  &aot_operand,
+  &ais_operand,
+  &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal l32i_iclass = {
+  3,
+  &l32i_operand_list[0]
+};
+
+static xtensa_insnbuf abs_template (void);
+static xtensa_insnbuf add_template (void);
+static xtensa_insnbuf add_n_template (void);
+static xtensa_insnbuf addi_template (void);
+static xtensa_insnbuf addi_n_template (void);
+static xtensa_insnbuf addmi_template (void);
+static xtensa_insnbuf addx2_template (void);
+static xtensa_insnbuf addx4_template (void);
+static xtensa_insnbuf addx8_template (void);
+static xtensa_insnbuf and_template (void);
+static xtensa_insnbuf ball_template (void);
+static xtensa_insnbuf bany_template (void);
+static xtensa_insnbuf bbc_template (void);
+static xtensa_insnbuf bbci_template (void);
+static xtensa_insnbuf bbs_template (void);
+static xtensa_insnbuf bbsi_template (void);
+static xtensa_insnbuf beq_template (void);
+static xtensa_insnbuf beqi_template (void);
+static xtensa_insnbuf beqz_template (void);
+static xtensa_insnbuf beqz_n_template (void);
+static xtensa_insnbuf bge_template (void);
+static xtensa_insnbuf bgei_template (void);
+static xtensa_insnbuf bgeu_template (void);
+static xtensa_insnbuf bgeui_template (void);
+static xtensa_insnbuf bgez_template (void);
+static xtensa_insnbuf blt_template (void);
+static xtensa_insnbuf blti_template (void);
+static xtensa_insnbuf bltu_template (void);
+static xtensa_insnbuf bltui_template (void);
+static xtensa_insnbuf bltz_template (void);
+static xtensa_insnbuf bnall_template (void);
+static xtensa_insnbuf bne_template (void);
+static xtensa_insnbuf bnei_template (void);
+static xtensa_insnbuf bnez_template (void);
+static xtensa_insnbuf bnez_n_template (void);
+static xtensa_insnbuf bnone_template (void);
+static xtensa_insnbuf break_template (void);
+static xtensa_insnbuf break_n_template (void);
+static xtensa_insnbuf call0_template (void);
+static xtensa_insnbuf call12_template (void);
+static xtensa_insnbuf call4_template (void);
+static xtensa_insnbuf call8_template (void);
+static xtensa_insnbuf callx0_template (void);
+static xtensa_insnbuf callx12_template (void);
+static xtensa_insnbuf callx4_template (void);
+static xtensa_insnbuf callx8_template (void);
+static xtensa_insnbuf dhi_template (void);
+static xtensa_insnbuf dhwb_template (void);
+static xtensa_insnbuf dhwbi_template (void);
+static xtensa_insnbuf dii_template (void);
+static xtensa_insnbuf diwb_template (void);
+static xtensa_insnbuf diwbi_template (void);
+static xtensa_insnbuf dpfr_template (void);
+static xtensa_insnbuf dpfro_template (void);
+static xtensa_insnbuf dpfw_template (void);
+static xtensa_insnbuf dpfwo_template (void);
+static xtensa_insnbuf dsync_template (void);
+static xtensa_insnbuf entry_template (void);
+static xtensa_insnbuf esync_template (void);
+static xtensa_insnbuf excw_template (void);
+static xtensa_insnbuf extui_template (void);
+static xtensa_insnbuf idtlb_template (void);
+static xtensa_insnbuf idtlba_template (void);
+static xtensa_insnbuf ihi_template (void);
+static xtensa_insnbuf iii_template (void);
+static xtensa_insnbuf iitlb_template (void);
+static xtensa_insnbuf iitlba_template (void);
+static xtensa_insnbuf ipf_template (void);
+static xtensa_insnbuf isync_template (void);
+static xtensa_insnbuf j_template (void);
+static xtensa_insnbuf jx_template (void);
+static xtensa_insnbuf l16si_template (void);
+static xtensa_insnbuf l16ui_template (void);
+static xtensa_insnbuf l32e_template (void);
+static xtensa_insnbuf l32i_template (void);
+static xtensa_insnbuf l32i_n_template (void);
+static xtensa_insnbuf l32r_template (void);
+static xtensa_insnbuf l8ui_template (void);
+static xtensa_insnbuf ldct_template (void);
+static xtensa_insnbuf lict_template (void);
+static xtensa_insnbuf licw_template (void);
+static xtensa_insnbuf loop_template (void);
+static xtensa_insnbuf loopgtz_template (void);
+static xtensa_insnbuf loopnez_template (void);
+static xtensa_insnbuf memw_template (void);
+static xtensa_insnbuf mov_n_template (void);
+static xtensa_insnbuf moveqz_template (void);
+static xtensa_insnbuf movgez_template (void);
+static xtensa_insnbuf movi_template (void);
+static xtensa_insnbuf movi_n_template (void);
+static xtensa_insnbuf movltz_template (void);
+static xtensa_insnbuf movnez_template (void);
+static xtensa_insnbuf movsp_template (void);
+static xtensa_insnbuf neg_template (void);
+static xtensa_insnbuf nop_n_template (void);
+static xtensa_insnbuf nsa_template (void);
+static xtensa_insnbuf nsau_template (void);
+static xtensa_insnbuf or_template (void);
+static xtensa_insnbuf pdtlb_template (void);
+static xtensa_insnbuf pitlb_template (void);
+static xtensa_insnbuf rdtlb0_template (void);
+static xtensa_insnbuf rdtlb1_template (void);
+static xtensa_insnbuf ret_template (void);
+static xtensa_insnbuf ret_n_template (void);
+static xtensa_insnbuf retw_template (void);
+static xtensa_insnbuf retw_n_template (void);
+static xtensa_insnbuf rfde_template (void);
+static xtensa_insnbuf rfe_template (void);
+static xtensa_insnbuf rfi_template (void);
+static xtensa_insnbuf rfwo_template (void);
+static xtensa_insnbuf rfwu_template (void);
+static xtensa_insnbuf ritlb0_template (void);
+static xtensa_insnbuf ritlb1_template (void);
+static xtensa_insnbuf rotw_template (void);
+static xtensa_insnbuf rsil_template (void);
+static xtensa_insnbuf rsr_template (void);
+static xtensa_insnbuf rsync_template (void);
+static xtensa_insnbuf s16i_template (void);
+static xtensa_insnbuf s32e_template (void);
+static xtensa_insnbuf s32i_template (void);
+static xtensa_insnbuf s32i_n_template (void);
+static xtensa_insnbuf s8i_template (void);
+static xtensa_insnbuf sdct_template (void);
+static xtensa_insnbuf sict_template (void);
+static xtensa_insnbuf sicw_template (void);
+static xtensa_insnbuf simcall_template (void);
+static xtensa_insnbuf sll_template (void);
+static xtensa_insnbuf slli_template (void);
+static xtensa_insnbuf sra_template (void);
+static xtensa_insnbuf srai_template (void);
+static xtensa_insnbuf src_template (void);
+static xtensa_insnbuf srl_template (void);
+static xtensa_insnbuf srli_template (void);
+static xtensa_insnbuf ssa8b_template (void);
+static xtensa_insnbuf ssa8l_template (void);
+static xtensa_insnbuf ssai_template (void);
+static xtensa_insnbuf ssl_template (void);
+static xtensa_insnbuf ssr_template (void);
+static xtensa_insnbuf sub_template (void);
+static xtensa_insnbuf subx2_template (void);
+static xtensa_insnbuf subx4_template (void);
+static xtensa_insnbuf subx8_template (void);
+static xtensa_insnbuf syscall_template (void);
+static xtensa_insnbuf waiti_template (void);
+static xtensa_insnbuf wdtlb_template (void);
+static xtensa_insnbuf witlb_template (void);
+static xtensa_insnbuf wsr_template (void);
+static xtensa_insnbuf xor_template (void);
+static xtensa_insnbuf xsr_template (void);
+
+static xtensa_insnbuf
+abs_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00001006 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+add_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000008 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+add_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00a00000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200c00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addi_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00b00000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addmi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200d00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addx2_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000009 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addx4_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000a };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+addx8_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000b };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+and_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000001 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ball_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700400 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bany_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700800 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bbc_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700500 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bbci_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700600 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bbs_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700d00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bbsi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700e00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+beq_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700100 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+beqi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00680000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+beqz_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00640000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+beqz_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00c80000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bge_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700a00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bgei_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006b0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bgeu_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700b00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bgeui_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006f0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bgez_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00670000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+blt_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+blti_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006a0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bltu_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bltui_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006e0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bltz_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00660000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bnall_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700c00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bne_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700900 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bnei_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00690000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bnez_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00650000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bnez_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00cc0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+bnone_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00700000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+break_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000400 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+break_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00d20f00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+call0_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00500000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+call12_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x005c0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+call4_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00540000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+call8_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00580000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+callx0_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00030000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+callx12_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x000f0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+callx4_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00070000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+callx8_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x000b0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dhi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00260700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dhwb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00240700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dhwbi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00250700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dii_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00270700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+diwb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00280740 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+diwbi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00280750 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dpfr_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dpfro_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00220700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dpfw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00210700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dpfwo_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00230700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+dsync_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00030200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+entry_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006c0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+esync_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00020200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+excw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00080200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+extui_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000040 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+idtlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000c05 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+idtlba_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000805 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ihi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x002e0700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+iii_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x002f0700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+iitlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000405 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+iitlba_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000005 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ipf_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x002c0700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+isync_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+j_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00600000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+jx_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x000a0000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l16si_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200900 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l16ui_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200100 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l32e_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000090 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l32i_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l32i_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00800000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l32r_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00100000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+l8ui_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ldct_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000081f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+lict_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000001f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+licw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000021f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+loop_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006d0800 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+loopgtz_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006d0a00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+loopnez_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x006d0900 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+memw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x000c0200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+mov_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00d00000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+moveqz_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000038 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movgez_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000003b };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200a00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movi_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00c00000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movltz_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000003a };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movnez_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000039 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+movsp_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000100 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+neg_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000006 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+nop_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00d30f00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+nsa_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000e04 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+nsau_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000f04 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+or_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000002 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+pdtlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000d05 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+pitlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000505 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rdtlb0_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000b05 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rdtlb1_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000f05 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ret_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00020000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ret_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00d00f00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+retw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00060000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+retw_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00d10f00 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rfde_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00002300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rfe_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rfi_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00010300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rfwo_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00004300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rfwu_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00005300 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ritlb0_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000305 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ritlb1_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000705 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rotw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000804 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rsil_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000600 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rsr_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000030 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+rsync_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00010200 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+s16i_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200500 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+s32e_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000094 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+s32i_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200600 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+s32i_n_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00900000 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+s8i_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00200400 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sdct_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000091f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sict_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000011f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sicw_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000031f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+simcall_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00001500 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sll_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000001a };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+slli_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000010 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sra_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000001b };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+srai_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000012 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+src_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000018 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+srl_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000019 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+srli_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000014 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ssa8b_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000304 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ssa8l_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000204 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ssai_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000404 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ssl_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000104 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+ssr_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000004 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+sub_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000c };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+subx2_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000d };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+subx4_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000e };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+subx8_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x0000000f };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+syscall_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000500 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+waiti_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000700 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+wdtlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000e05 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+witlb_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000605 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+wsr_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000031 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+xor_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000003 };
+  return &template[0];
+}
+
+static xtensa_insnbuf
+xsr_template (void)
+{
+  static xtensa_insnbuf_word template[] = { 0x00000016 };
+  return &template[0];
+}
+
+static xtensa_opcode_internal abs_opcode = {
+  "abs",
+  3,
+  abs_template,
+  &neg_iclass
+};
+
+static xtensa_opcode_internal add_opcode = {
+  "add",
+  3,
+  add_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal add_n_opcode = {
+  "add.n",
+  2,
+  add_n_template,
+  &add_n_iclass
+};
+
+static xtensa_opcode_internal addi_opcode = {
+  "addi",
+  3,
+  addi_template,
+  &addi_iclass
+};
+
+static xtensa_opcode_internal addi_n_opcode = {
+  "addi.n",
+  2,
+  addi_n_template,
+  &addi_n_iclass
+};
+
+static xtensa_opcode_internal addmi_opcode = {
+  "addmi",
+  3,
+  addmi_template,
+  &addmi_iclass
+};
+
+static xtensa_opcode_internal addx2_opcode = {
+  "addx2",
+  3,
+  addx2_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal addx4_opcode = {
+  "addx4",
+  3,
+  addx4_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal addx8_opcode = {
+  "addx8",
+  3,
+  addx8_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal and_opcode = {
+  "and",
+  3,
+  and_template,
+  &bit_iclass
+};
+
+static xtensa_opcode_internal ball_opcode = {
+  "ball",
+  3,
+  ball_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bany_opcode = {
+  "bany",
+  3,
+  bany_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bbc_opcode = {
+  "bbc",
+  3,
+  bbc_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bbci_opcode = {
+  "bbci",
+  3,
+  bbci_template,
+  &bsi8b_iclass
+};
+
+static xtensa_opcode_internal bbs_opcode = {
+  "bbs",
+  3,
+  bbs_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bbsi_opcode = {
+  "bbsi",
+  3,
+  bbsi_template,
+  &bsi8b_iclass
+};
+
+static xtensa_opcode_internal beq_opcode = {
+  "beq",
+  3,
+  beq_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal beqi_opcode = {
+  "beqi",
+  3,
+  beqi_template,
+  &bsi8_iclass
+};
+
+static xtensa_opcode_internal beqz_opcode = {
+  "beqz",
+  3,
+  beqz_template,
+  &bsz12_iclass
+};
+
+static xtensa_opcode_internal beqz_n_opcode = {
+  "beqz.n",
+  2,
+  beqz_n_template,
+  &bz6_iclass
+};
+
+static xtensa_opcode_internal bge_opcode = {
+  "bge",
+  3,
+  bge_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bgei_opcode = {
+  "bgei",
+  3,
+  bgei_template,
+  &bsi8_iclass
+};
+
+static xtensa_opcode_internal bgeu_opcode = {
+  "bgeu",
+  3,
+  bgeu_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bgeui_opcode = {
+  "bgeui",
+  3,
+  bgeui_template,
+  &bsi8u_iclass
+};
+
+static xtensa_opcode_internal bgez_opcode = {
+  "bgez",
+  3,
+  bgez_template,
+  &bsz12_iclass
+};
+
+static xtensa_opcode_internal blt_opcode = {
+  "blt",
+  3,
+  blt_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal blti_opcode = {
+  "blti",
+  3,
+  blti_template,
+  &bsi8_iclass
+};
+
+static xtensa_opcode_internal bltu_opcode = {
+  "bltu",
+  3,
+  bltu_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bltui_opcode = {
+  "bltui",
+  3,
+  bltui_template,
+  &bsi8u_iclass
+};
+
+static xtensa_opcode_internal bltz_opcode = {
+  "bltz",
+  3,
+  bltz_template,
+  &bsz12_iclass
+};
+
+static xtensa_opcode_internal bnall_opcode = {
+  "bnall",
+  3,
+  bnall_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bne_opcode = {
+  "bne",
+  3,
+  bne_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal bnei_opcode = {
+  "bnei",
+  3,
+  bnei_template,
+  &bsi8_iclass
+};
+
+static xtensa_opcode_internal bnez_opcode = {
+  "bnez",
+  3,
+  bnez_template,
+  &bsz12_iclass
+};
+
+static xtensa_opcode_internal bnez_n_opcode = {
+  "bnez.n",
+  2,
+  bnez_n_template,
+  &bz6_iclass
+};
+
+static xtensa_opcode_internal bnone_opcode = {
+  "bnone",
+  3,
+  bnone_template,
+  &bst8_iclass
+};
+
+static xtensa_opcode_internal break_opcode = {
+  "break",
+  3,
+  break_template,
+  &break_iclass
+};
+
+static xtensa_opcode_internal break_n_opcode = {
+  "break.n",
+  2,
+  break_n_template,
+  &break_n_iclass
+};
+
+static xtensa_opcode_internal call0_opcode = {
+  "call0",
+  3,
+  call0_template,
+  &call_iclass
+};
+
+static xtensa_opcode_internal call12_opcode = {
+  "call12",
+  3,
+  call12_template,
+  &call12_iclass
+};
+
+static xtensa_opcode_internal call4_opcode = {
+  "call4",
+  3,
+  call4_template,
+  &call4_iclass
+};
+
+static xtensa_opcode_internal call8_opcode = {
+  "call8",
+  3,
+  call8_template,
+  &call8_iclass
+};
+
+static xtensa_opcode_internal callx0_opcode = {
+  "callx0",
+  3,
+  callx0_template,
+  &callx_iclass
+};
+
+static xtensa_opcode_internal callx12_opcode = {
+  "callx12",
+  3,
+  callx12_template,
+  &callx12_iclass
+};
+
+static xtensa_opcode_internal callx4_opcode = {
+  "callx4",
+  3,
+  callx4_template,
+  &callx4_iclass
+};
+
+static xtensa_opcode_internal callx8_opcode = {
+  "callx8",
+  3,
+  callx8_template,
+  &callx8_iclass
+};
+
+static xtensa_opcode_internal dhi_opcode = {
+  "dhi",
+  3,
+  dhi_template,
+  &dcache_iclass
+};
+
+static xtensa_opcode_internal dhwb_opcode = {
+  "dhwb",
+  3,
+  dhwb_template,
+  &dcache_iclass
+};
+
+static xtensa_opcode_internal dhwbi_opcode = {
+  "dhwbi",
+  3,
+  dhwbi_template,
+  &dcache_iclass
+};
+
+static xtensa_opcode_internal dii_opcode = {
+  "dii",
+  3,
+  dii_template,
+  &dcache_iclass
+};
+
+static xtensa_opcode_internal diwb_opcode = {
+  "diwb",
+  3,
+  diwb_template,
+  &dce_iclass
+};
+
+static xtensa_opcode_internal diwbi_opcode = {
+  "diwbi",
+  3,
+  diwbi_template,
+  &dce_iclass
+};
+
+static xtensa_opcode_internal dpfr_opcode = {
+  "dpfr",
+  3,
+  dpfr_template,
+  &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfro_opcode = {
+  "dpfro",
+  3,
+  dpfro_template,
+  &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfw_opcode = {
+  "dpfw",
+  3,
+  dpfw_template,
+  &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfwo_opcode = {
+  "dpfwo",
+  3,
+  dpfwo_template,
+  &dpf_iclass
+};
+
+static xtensa_opcode_internal dsync_opcode = {
+  "dsync",
+  3,
+  dsync_template,
+  &sync_iclass
+};
+
+static xtensa_opcode_internal entry_opcode = {
+  "entry",
+  3,
+  entry_template,
+  &entry_iclass
+};
+
+static xtensa_opcode_internal esync_opcode = {
+  "esync",
+  3,
+  esync_template,
+  &sync_iclass
+};
+
+static xtensa_opcode_internal excw_opcode = {
+  "excw",
+  3,
+  excw_template,
+  &excw_iclass
+};
+
+static xtensa_opcode_internal extui_opcode = {
+  "extui",
+  3,
+  extui_template,
+  &exti_iclass
+};
+
+static xtensa_opcode_internal idtlb_opcode = {
+  "idtlb",
+  3,
+  idtlb_template,
+  &itlb_iclass
+};
+
+static xtensa_opcode_internal idtlba_opcode = {
+  "idtlba",
+  3,
+  idtlba_template,
+  &itlba_iclass
+};
+
+static xtensa_opcode_internal ihi_opcode = {
+  "ihi",
+  3,
+  ihi_template,
+  &icache_iclass
+};
+
+static xtensa_opcode_internal iii_opcode = {
+  "iii",
+  3,
+  iii_template,
+  &icache_iclass
+};
+
+static xtensa_opcode_internal iitlb_opcode = {
+  "iitlb",
+  3,
+  iitlb_template,
+  &itlb_iclass
+};
+
+static xtensa_opcode_internal iitlba_opcode = {
+  "iitlba",
+  3,
+  iitlba_template,
+  &itlba_iclass
+};
+
+static xtensa_opcode_internal ipf_opcode = {
+  "ipf",
+  3,
+  ipf_template,
+  &icache_iclass
+};
+
+static xtensa_opcode_internal isync_opcode = {
+  "isync",
+  3,
+  isync_template,
+  &sync_iclass
+};
+
+static xtensa_opcode_internal j_opcode = {
+  "j",
+  3,
+  j_template,
+  &jump_iclass
+};
+
+static xtensa_opcode_internal jx_opcode = {
+  "jx",
+  3,
+  jx_template,
+  &jumpx_iclass
+};
+
+static xtensa_opcode_internal l16si_opcode = {
+  "l16si",
+  3,
+  l16si_template,
+  &l16i_iclass
+};
+
+static xtensa_opcode_internal l16ui_opcode = {
+  "l16ui",
+  3,
+  l16ui_template,
+  &l16i_iclass
+};
+
+static xtensa_opcode_internal l32e_opcode = {
+  "l32e",
+  3,
+  l32e_template,
+  &l32e_iclass
+};
+
+static xtensa_opcode_internal l32i_opcode = {
+  "l32i",
+  3,
+  l32i_template,
+  &l32i_iclass
+};
+
+static xtensa_opcode_internal l32i_n_opcode = {
+  "l32i.n",
+  2,
+  l32i_n_template,
+  &loadi4_iclass
+};
+
+static xtensa_opcode_internal l32r_opcode = {
+  "l32r",
+  3,
+  l32r_template,
+  &l32r_iclass
+};
+
+static xtensa_opcode_internal l8ui_opcode = {
+  "l8ui",
+  3,
+  l8ui_template,
+  &l8i_iclass
+};
+
+static xtensa_opcode_internal ldct_opcode = {
+  "ldct",
+  3,
+  ldct_template,
+  &actl_iclass
+};
+
+static xtensa_opcode_internal lict_opcode = {
+  "lict",
+  3,
+  lict_template,
+  &actl_iclass
+};
+
+static xtensa_opcode_internal licw_opcode = {
+  "licw",
+  3,
+  licw_template,
+  &actl_iclass
+};
+
+static xtensa_opcode_internal loop_opcode = {
+  "loop",
+  3,
+  loop_template,
+  &loop_iclass
+};
+
+static xtensa_opcode_internal loopgtz_opcode = {
+  "loopgtz",
+  3,
+  loopgtz_template,
+  &loop_iclass
+};
+
+static xtensa_opcode_internal loopnez_opcode = {
+  "loopnez",
+  3,
+  loopnez_template,
+  &loop_iclass
+};
+
+static xtensa_opcode_internal memw_opcode = {
+  "memw",
+  3,
+  memw_template,
+  &sync_iclass
+};
+
+static xtensa_opcode_internal mov_n_opcode = {
+  "mov.n",
+  2,
+  mov_n_template,
+  &mov_n_iclass
+};
+
+static xtensa_opcode_internal moveqz_opcode = {
+  "moveqz",
+  3,
+  moveqz_template,
+  &movz_iclass
+};
+
+static xtensa_opcode_internal movgez_opcode = {
+  "movgez",
+  3,
+  movgez_template,
+  &movz_iclass
+};
+
+static xtensa_opcode_internal movi_opcode = {
+  "movi",
+  3,
+  movi_template,
+  &movi_iclass
+};
+
+static xtensa_opcode_internal movi_n_opcode = {
+  "movi.n",
+  2,
+  movi_n_template,
+  &movi_n_iclass
+};
+
+static xtensa_opcode_internal movltz_opcode = {
+  "movltz",
+  3,
+  movltz_template,
+  &movz_iclass
+};
+
+static xtensa_opcode_internal movnez_opcode = {
+  "movnez",
+  3,
+  movnez_template,
+  &movz_iclass
+};
+
+static xtensa_opcode_internal movsp_opcode = {
+  "movsp",
+  3,
+  movsp_template,
+  &movsp_iclass
+};
+
+static xtensa_opcode_internal neg_opcode = {
+  "neg",
+  3,
+  neg_template,
+  &neg_iclass
+};
+
+static xtensa_opcode_internal nop_n_opcode = {
+  "nop.n",
+  2,
+  nop_n_template,
+  &nopn_iclass
+};
+
+static xtensa_opcode_internal nsa_opcode = {
+  "nsa",
+  3,
+  nsa_template,
+  &nsa_iclass
+};
+
+static xtensa_opcode_internal nsau_opcode = {
+  "nsau",
+  3,
+  nsau_template,
+  &nsa_iclass
+};
+
+static xtensa_opcode_internal or_opcode = {
+  "or",
+  3,
+  or_template,
+  &bit_iclass
+};
+
+static xtensa_opcode_internal pdtlb_opcode = {
+  "pdtlb",
+  3,
+  pdtlb_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal pitlb_opcode = {
+  "pitlb",
+  3,
+  pitlb_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal rdtlb0_opcode = {
+  "rdtlb0",
+  3,
+  rdtlb0_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal rdtlb1_opcode = {
+  "rdtlb1",
+  3,
+  rdtlb1_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal ret_opcode = {
+  "ret",
+  3,
+  ret_template,
+  &return_iclass
+};
+
+static xtensa_opcode_internal ret_n_opcode = {
+  "ret.n",
+  2,
+  ret_n_template,
+  &retn_iclass
+};
+
+static xtensa_opcode_internal retw_opcode = {
+  "retw",
+  3,
+  retw_template,
+  &return_iclass
+};
+
+static xtensa_opcode_internal retw_n_opcode = {
+  "retw.n",
+  2,
+  retw_n_template,
+  &retn_iclass
+};
+
+static xtensa_opcode_internal rfde_opcode = {
+  "rfde",
+  3,
+  rfde_template,
+  &rfe_iclass
+};
+
+static xtensa_opcode_internal rfe_opcode = {
+  "rfe",
+  3,
+  rfe_template,
+  &rfe_iclass
+};
+
+static xtensa_opcode_internal rfi_opcode = {
+  "rfi",
+  3,
+  rfi_template,
+  &rfi_iclass
+};
+
+static xtensa_opcode_internal rfwo_opcode = {
+  "rfwo",
+  3,
+  rfwo_template,
+  &rfe_iclass
+};
+
+static xtensa_opcode_internal rfwu_opcode = {
+  "rfwu",
+  3,
+  rfwu_template,
+  &rfe_iclass
+};
+
+static xtensa_opcode_internal ritlb0_opcode = {
+  "ritlb0",
+  3,
+  ritlb0_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal ritlb1_opcode = {
+  "ritlb1",
+  3,
+  ritlb1_template,
+  &rtlb_iclass
+};
+
+static xtensa_opcode_internal rotw_opcode = {
+  "rotw",
+  3,
+  rotw_template,
+  &rotw_iclass
+};
+
+static xtensa_opcode_internal rsil_opcode = {
+  "rsil",
+  3,
+  rsil_template,
+  &rsil_iclass
+};
+
+static xtensa_opcode_internal rsr_opcode = {
+  "rsr",
+  3,
+  rsr_template,
+  &rsr_iclass
+};
+
+static xtensa_opcode_internal rsync_opcode = {
+  "rsync",
+  3,
+  rsync_template,
+  &sync_iclass
+};
+
+static xtensa_opcode_internal s16i_opcode = {
+  "s16i",
+  3,
+  s16i_template,
+  &s16i_iclass
+};
+
+static xtensa_opcode_internal s32e_opcode = {
+  "s32e",
+  3,
+  s32e_template,
+  &s32e_iclass
+};
+
+static xtensa_opcode_internal s32i_opcode = {
+  "s32i",
+  3,
+  s32i_template,
+  &s32i_iclass
+};
+
+static xtensa_opcode_internal s32i_n_opcode = {
+  "s32i.n",
+  2,
+  s32i_n_template,
+  &storei4_iclass
+};
+
+static xtensa_opcode_internal s8i_opcode = {
+  "s8i",
+  3,
+  s8i_template,
+  &s8i_iclass
+};
+
+static xtensa_opcode_internal sdct_opcode = {
+  "sdct",
+  3,
+  sdct_template,
+  &acts_iclass
+};
+
+static xtensa_opcode_internal sict_opcode = {
+  "sict",
+  3,
+  sict_template,
+  &acts_iclass
+};
+
+static xtensa_opcode_internal sicw_opcode = {
+  "sicw",
+  3,
+  sicw_template,
+  &acts_iclass
+};
+
+static xtensa_opcode_internal simcall_opcode = {
+  "simcall",
+  3,
+  simcall_template,
+  &syscall_iclass
+};
+
+static xtensa_opcode_internal sll_opcode = {
+  "sll",
+  3,
+  sll_template,
+  &shifts_iclass
+};
+
+static xtensa_opcode_internal slli_opcode = {
+  "slli",
+  3,
+  slli_template,
+  &slli_iclass
+};
+
+static xtensa_opcode_internal sra_opcode = {
+  "sra",
+  3,
+  sra_template,
+  &shiftt_iclass
+};
+
+static xtensa_opcode_internal srai_opcode = {
+  "srai",
+  3,
+  srai_template,
+  &srai_iclass
+};
+
+static xtensa_opcode_internal src_opcode = {
+  "src",
+  3,
+  src_template,
+  &shiftst_iclass
+};
+
+static xtensa_opcode_internal srl_opcode = {
+  "srl",
+  3,
+  srl_template,
+  &shiftt_iclass
+};
+
+static xtensa_opcode_internal srli_opcode = {
+  "srli",
+  3,
+  srli_template,
+  &srli_iclass
+};
+
+static xtensa_opcode_internal ssa8b_opcode = {
+  "ssa8b",
+  3,
+  ssa8b_template,
+  &sar_iclass
+};
+
+static xtensa_opcode_internal ssa8l_opcode = {
+  "ssa8l",
+  3,
+  ssa8l_template,
+  &sar_iclass
+};
+
+static xtensa_opcode_internal ssai_opcode = {
+  "ssai",
+  3,
+  ssai_template,
+  &sari_iclass
+};
+
+static xtensa_opcode_internal ssl_opcode = {
+  "ssl",
+  3,
+  ssl_template,
+  &sar_iclass
+};
+
+static xtensa_opcode_internal ssr_opcode = {
+  "ssr",
+  3,
+  ssr_template,
+  &sar_iclass
+};
+
+static xtensa_opcode_internal sub_opcode = {
+  "sub",
+  3,
+  sub_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal subx2_opcode = {
+  "subx2",
+  3,
+  subx2_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal subx4_opcode = {
+  "subx4",
+  3,
+  subx4_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal subx8_opcode = {
+  "subx8",
+  3,
+  subx8_template,
+  &addsub_iclass
+};
+
+static xtensa_opcode_internal syscall_opcode = {
+  "syscall",
+  3,
+  syscall_template,
+  &syscall_iclass
+};
+
+static xtensa_opcode_internal waiti_opcode = {
+  "waiti",
+  3,
+  waiti_template,
+  &wait_iclass
+};
+
+static xtensa_opcode_internal wdtlb_opcode = {
+  "wdtlb",
+  3,
+  wdtlb_template,
+  &wtlb_iclass
+};
+
+static xtensa_opcode_internal witlb_opcode = {
+  "witlb",
+  3,
+  witlb_template,
+  &wtlb_iclass
+};
+
+static xtensa_opcode_internal wsr_opcode = {
+  "wsr",
+  3,
+  wsr_template,
+  &wsr_iclass
+};
+
+static xtensa_opcode_internal xor_opcode = {
+  "xor",
+  3,
+  xor_template,
+  &bit_iclass
+};
+
+static xtensa_opcode_internal xsr_opcode = {
+  "xsr",
+  3,
+  xsr_template,
+  &xsr_iclass
+};
+
+static xtensa_opcode_internal * opcodes[149] = {
+  &abs_opcode,
+  &add_opcode,
+  &add_n_opcode,
+  &addi_opcode,
+  &addi_n_opcode,
+  &addmi_opcode,
+  &addx2_opcode,
+  &addx4_opcode,
+  &addx8_opcode,
+  &and_opcode,
+  &ball_opcode,
+  &bany_opcode,
+  &bbc_opcode,
+  &bbci_opcode,
+  &bbs_opcode,
+  &bbsi_opcode,
+  &beq_opcode,
+  &beqi_opcode,
+  &beqz_opcode,
+  &beqz_n_opcode,
+  &bge_opcode,
+  &bgei_opcode,
+  &bgeu_opcode,
+  &bgeui_opcode,
+  &bgez_opcode,
+  &blt_opcode,
+  &blti_opcode,
+  &bltu_opcode,
+  &bltui_opcode,
+  &bltz_opcode,
+  &bnall_opcode,
+  &bne_opcode,
+  &bnei_opcode,
+  &bnez_opcode,
+  &bnez_n_opcode,
+  &bnone_opcode,
+  &break_opcode,
+  &break_n_opcode,
+  &call0_opcode,
+  &call12_opcode,
+  &call4_opcode,
+  &call8_opcode,
+  &callx0_opcode,
+  &callx12_opcode,
+  &callx4_opcode,
+  &callx8_opcode,
+  &dhi_opcode,
+  &dhwb_opcode,
+  &dhwbi_opcode,
+  &dii_opcode,
+  &diwb_opcode,
+  &diwbi_opcode,
+  &dpfr_opcode,
+  &dpfro_opcode,
+  &dpfw_opcode,
+  &dpfwo_opcode,
+  &dsync_opcode,
+  &entry_opcode,
+  &esync_opcode,
+  &excw_opcode,
+  &extui_opcode,
+  &idtlb_opcode,
+  &idtlba_opcode,
+  &ihi_opcode,
+  &iii_opcode,
+  &iitlb_opcode,
+  &iitlba_opcode,
+  &ipf_opcode,
+  &isync_opcode,
+  &j_opcode,
+  &jx_opcode,
+  &l16si_opcode,
+  &l16ui_opcode,
+  &l32e_opcode,
+  &l32i_opcode,
+  &l32i_n_opcode,
+  &l32r_opcode,
+  &l8ui_opcode,
+  &ldct_opcode,
+  &lict_opcode,
+  &licw_opcode,
+  &loop_opcode,
+  &loopgtz_opcode,
+  &loopnez_opcode,
+  &memw_opcode,
+  &mov_n_opcode,
+  &moveqz_opcode,
+  &movgez_opcode,
+  &movi_opcode,
+  &movi_n_opcode,
+  &movltz_opcode,
+  &movnez_opcode,
+  &movsp_opcode,
+  &neg_opcode,
+  &nop_n_opcode,
+  &nsa_opcode,
+  &nsau_opcode,
+  &or_opcode,
+  &pdtlb_opcode,
+  &pitlb_opcode,
+  &rdtlb0_opcode,
+  &rdtlb1_opcode,
+  &ret_opcode,
+  &ret_n_opcode,
+  &retw_opcode,
+  &retw_n_opcode,
+  &rfde_opcode,
+  &rfe_opcode,
+  &rfi_opcode,
+  &rfwo_opcode,
+  &rfwu_opcode,
+  &ritlb0_opcode,
+  &ritlb1_opcode,
+  &rotw_opcode,
+  &rsil_opcode,
+  &rsr_opcode,
+  &rsync_opcode,
+  &s16i_opcode,
+  &s32e_opcode,
+  &s32i_opcode,
+  &s32i_n_opcode,
+  &s8i_opcode,
+  &sdct_opcode,
+  &sict_opcode,
+  &sicw_opcode,
+  &simcall_opcode,
+  &sll_opcode,
+  &slli_opcode,
+  &sra_opcode,
+  &srai_opcode,
+  &src_opcode,
+  &srl_opcode,
+  &srli_opcode,
+  &ssa8b_opcode,
+  &ssa8l_opcode,
+  &ssai_opcode,
+  &ssl_opcode,
+  &ssr_opcode,
+  &sub_opcode,
+  &subx2_opcode,
+  &subx4_opcode,
+  &subx8_opcode,
+  &syscall_opcode,
+  &waiti_opcode,
+  &wdtlb_opcode,
+  &witlb_opcode,
+  &wsr_opcode,
+  &xor_opcode,
+  &xsr_opcode
+};
+
+xtensa_opcode_internal **
+get_opcodes (void)
+{
+  return &opcodes[0];
+}
+
+int
+get_num_opcodes (void)
+{
+  return 149;
+}
+
+#define xtensa_abs_op 0
+#define xtensa_add_op 1
+#define xtensa_add_n_op 2
+#define xtensa_addi_op 3
+#define xtensa_addi_n_op 4
+#define xtensa_addmi_op 5
+#define xtensa_addx2_op 6
+#define xtensa_addx4_op 7
+#define xtensa_addx8_op 8
+#define xtensa_and_op 9
+#define xtensa_ball_op 10
+#define xtensa_bany_op 11
+#define xtensa_bbc_op 12
+#define xtensa_bbci_op 13
+#define xtensa_bbs_op 14
+#define xtensa_bbsi_op 15
+#define xtensa_beq_op 16
+#define xtensa_beqi_op 17
+#define xtensa_beqz_op 18
+#define xtensa_beqz_n_op 19
+#define xtensa_bge_op 20
+#define xtensa_bgei_op 21
+#define xtensa_bgeu_op 22
+#define xtensa_bgeui_op 23
+#define xtensa_bgez_op 24
+#define xtensa_blt_op 25
+#define xtensa_blti_op 26
+#define xtensa_bltu_op 27
+#define xtensa_bltui_op 28
+#define xtensa_bltz_op 29
+#define xtensa_bnall_op 30
+#define xtensa_bne_op 31
+#define xtensa_bnei_op 32
+#define xtensa_bnez_op 33
+#define xtensa_bnez_n_op 34
+#define xtensa_bnone_op 35
+#define xtensa_break_op 36
+#define xtensa_break_n_op 37
+#define xtensa_call0_op 38
+#define xtensa_call12_op 39
+#define xtensa_call4_op 40
+#define xtensa_call8_op 41
+#define xtensa_callx0_op 42
+#define xtensa_callx12_op 43
+#define xtensa_callx4_op 44
+#define xtensa_callx8_op 45
+#define xtensa_dhi_op 46
+#define xtensa_dhwb_op 47
+#define xtensa_dhwbi_op 48
+#define xtensa_dii_op 49
+#define xtensa_diwb_op 50
+#define xtensa_diwbi_op 51
+#define xtensa_dpfr_op 52
+#define xtensa_dpfro_op 53
+#define xtensa_dpfw_op 54
+#define xtensa_dpfwo_op 55
+#define xtensa_dsync_op 56
+#define xtensa_entry_op 57
+#define xtensa_esync_op 58
+#define xtensa_excw_op 59
+#define xtensa_extui_op 60
+#define xtensa_idtlb_op 61
+#define xtensa_idtlba_op 62
+#define xtensa_ihi_op 63
+#define xtensa_iii_op 64
+#define xtensa_iitlb_op 65
+#define xtensa_iitlba_op 66
+#define xtensa_ipf_op 67
+#define xtensa_isync_op 68
+#define xtensa_j_op 69
+#define xtensa_jx_op 70
+#define xtensa_l16si_op 71
+#define xtensa_l16ui_op 72
+#define xtensa_l32e_op 73
+#define xtensa_l32i_op 74
+#define xtensa_l32i_n_op 75
+#define xtensa_l32r_op 76
+#define xtensa_l8ui_op 77
+#define xtensa_ldct_op 78
+#define xtensa_lict_op 79
+#define xtensa_licw_op 80
+#define xtensa_loop_op 81
+#define xtensa_loopgtz_op 82
+#define xtensa_loopnez_op 83
+#define xtensa_memw_op 84
+#define xtensa_mov_n_op 85
+#define xtensa_moveqz_op 86
+#define xtensa_movgez_op 87
+#define xtensa_movi_op 88
+#define xtensa_movi_n_op 89
+#define xtensa_movltz_op 90
+#define xtensa_movnez_op 91
+#define xtensa_movsp_op 92
+#define xtensa_neg_op 93
+#define xtensa_nop_n_op 94
+#define xtensa_nsa_op 95
+#define xtensa_nsau_op 96
+#define xtensa_or_op 97
+#define xtensa_pdtlb_op 98
+#define xtensa_pitlb_op 99
+#define xtensa_rdtlb0_op 100
+#define xtensa_rdtlb1_op 101
+#define xtensa_ret_op 102
+#define xtensa_ret_n_op 103
+#define xtensa_retw_op 104
+#define xtensa_retw_n_op 105
+#define xtensa_rfde_op 106
+#define xtensa_rfe_op 107
+#define xtensa_rfi_op 108
+#define xtensa_rfwo_op 109
+#define xtensa_rfwu_op 110
+#define xtensa_ritlb0_op 111
+#define xtensa_ritlb1_op 112
+#define xtensa_rotw_op 113
+#define xtensa_rsil_op 114
+#define xtensa_rsr_op 115
+#define xtensa_rsync_op 116
+#define xtensa_s16i_op 117
+#define xtensa_s32e_op 118
+#define xtensa_s32i_op 119
+#define xtensa_s32i_n_op 120
+#define xtensa_s8i_op 121
+#define xtensa_sdct_op 122
+#define xtensa_sict_op 123
+#define xtensa_sicw_op 124
+#define xtensa_simcall_op 125
+#define xtensa_sll_op 126
+#define xtensa_slli_op 127
+#define xtensa_sra_op 128
+#define xtensa_srai_op 129
+#define xtensa_src_op 130
+#define xtensa_srl_op 131
+#define xtensa_srli_op 132
+#define xtensa_ssa8b_op 133
+#define xtensa_ssa8l_op 134
+#define xtensa_ssai_op 135
+#define xtensa_ssl_op 136
+#define xtensa_ssr_op 137
+#define xtensa_sub_op 138
+#define xtensa_subx2_op 139
+#define xtensa_subx4_op 140
+#define xtensa_subx8_op 141
+#define xtensa_syscall_op 142
+#define xtensa_waiti_op 143
+#define xtensa_wdtlb_op 144
+#define xtensa_witlb_op 145
+#define xtensa_wsr_op 146
+#define xtensa_xor_op 147
+#define xtensa_xsr_op 148
+
+int
+decode_insn (const xtensa_insnbuf insn)
+{
+  switch (get_op0_field (insn)) {
+  case 0: /* QRST: op0=0000 */
+    switch (get_op1_field (insn)) {
+    case 3: /* RST3: op1=0011 */
+      switch (get_op2_field (insn)) {
+      case 8: /* MOVEQZ: op2=1000 */
+        return xtensa_moveqz_op;
+      case 9: /* MOVNEZ: op2=1001 */
+        return xtensa_movnez_op;
+      case 10: /* MOVLTZ: op2=1010 */
+        return xtensa_movltz_op;
+      case 11: /* MOVGEZ: op2=1011 */
+        return xtensa_movgez_op;
+      case 0: /* RSR: op2=0000 */
+        return xtensa_rsr_op;
+      case 1: /* WSR: op2=0001 */
+        return xtensa_wsr_op;
+      }
+      break;
+    case 9: /* LSI4: op1=1001 */
+      switch (get_op2_field (insn)) {
+      case 4: /* S32E: op2=0100 */
+        return xtensa_s32e_op;
+      case 0: /* L32E: op2=0000 */
+        return xtensa_l32e_op;
+      }
+      break;
+    case 4: /* EXTUI: op1=010x */
+    case 5: /* EXTUI: op1=010x */
+      return xtensa_extui_op;
+    case 0: /* RST0: op1=0000 */
+      switch (get_op2_field (insn)) {
+      case 15: /* SUBX8: op2=1111 */
+        return xtensa_subx8_op;
+      case 0: /* ST0: op2=0000 */
+        switch (get_r_field (insn)) {
+        case 0: /* SNM0: r=0000 */
+          switch (get_m_field (insn)) {
+          case 2: /* JR: m=10 */
+            switch (get_n_field (insn)) {
+            case 0: /* RET: n=00 */
+              return xtensa_ret_op;
+            case 1: /* RETW: n=01 */
+              return xtensa_retw_op;
+            case 2: /* JX: n=10 */
+              return xtensa_jx_op;
+            }
+            break;
+          case 3: /* CALLX: m=11 */
+            switch (get_n_field (insn)) {
+            case 0: /* CALLX0: n=00 */
+              return xtensa_callx0_op;
+            case 1: /* CALLX4: n=01 */
+              return xtensa_callx4_op;
+            case 2: /* CALLX8: n=10 */
+              return xtensa_callx8_op;
+            case 3: /* CALLX12: n=11 */
+              return xtensa_callx12_op;
+            }
+            break;
+          }
+          break;
+        case 1: /* MOVSP: r=0001 */
+          return xtensa_movsp_op;
+        case 2: /* SYNC: r=0010 */
+          switch (get_s_field (insn)) {
+          case 0: /* SYNCT: s=0000 */
+            switch (get_t_field (insn)) {
+            case 2: /* ESYNC: t=0010 */
+              return xtensa_esync_op;
+            case 3: /* DSYNC: t=0011 */
+              return xtensa_dsync_op;
+            case 8: /* EXCW: t=1000 */
+              return xtensa_excw_op;
+            case 12: /* MEMW: t=1100 */
+              return xtensa_memw_op;
+            case 0: /* ISYNC: t=0000 */
+              return xtensa_isync_op;
+            case 1: /* RSYNC: t=0001 */
+              return xtensa_rsync_op;
+            }
+            break;
+          }
+          break;
+        case 4: /* BREAK: r=0100 */
+          return xtensa_break_op;
+        case 3: /* RFEI: r=0011 */
+          switch (get_t_field (insn)) {
+          case 0: /* RFET: t=0000 */
+            switch (get_s_field (insn)) {
+            case 2: /* RFDE: s=0010 */
+              return xtensa_rfde_op;
+            case 4: /* RFWO: s=0100 */
+              return xtensa_rfwo_op;
+            case 5: /* RFWU: s=0101 */
+              return xtensa_rfwu_op;
+            case 0: /* RFE: s=0000 */
+              return xtensa_rfe_op;
+            }
+            break;
+          case 1: /* RFI: t=0001 */
+            return xtensa_rfi_op;
+          }
+          break;
+        case 5: /* SCALL: r=0101 */
+          switch (get_s_field (insn)) {
+          case 0: /* SYSCALL: s=0000 */
+            return xtensa_syscall_op;
+          case 1: /* SIMCALL: s=0001 */
+            return xtensa_simcall_op;
+          }
+          break;
+        case 6: /* RSIL: r=0110 */
+          return xtensa_rsil_op;
+        case 7: /* WAITI: r=0111 */
+          return xtensa_waiti_op;
+        }
+        break;
+      case 1: /* AND: op2=0001 */
+        return xtensa_and_op;
+      case 2: /* OR: op2=0010 */
+        return xtensa_or_op;
+      case 3: /* XOR: op2=0011 */
+        return xtensa_xor_op;
+      case 4: /* ST1: op2=0100 */
+        switch (get_r_field (insn)) {
+        case 15: /* NSAU: r=1111 */
+          return xtensa_nsau_op;
+        case 0: /* SSR: r=0000 */
+          return xtensa_ssr_op;
+        case 1: /* SSL: r=0001 */
+          return xtensa_ssl_op;
+        case 2: /* SSA8L: r=0010 */
+          return xtensa_ssa8l_op;
+        case 3: /* SSA8B: r=0011 */
+          return xtensa_ssa8b_op;
+        case 4: /* SSAI: r=0100 */
+          return xtensa_ssai_op;
+        case 8: /* ROTW: r=1000 */
+          return xtensa_rotw_op;
+        case 14: /* NSA: r=1110 */
+          return xtensa_nsa_op;
+        }
+        break;
+      case 8: /* ADD: op2=1000 */
+        return xtensa_add_op;
+      case 5: /* ST4: op2=0101 */
+        switch (get_r_field (insn)) {
+        case 15: /* RDTLB1: r=1111 */
+          return xtensa_rdtlb1_op;
+        case 0: /* IITLBA: r=0000 */
+          return xtensa_iitlba_op;
+        case 3: /* RITLB0: r=0011 */
+          return xtensa_ritlb0_op;
+        case 4: /* IITLB: r=0100 */
+          return xtensa_iitlb_op;
+        case 8: /* IDTLBA: r=1000 */
+          return xtensa_idtlba_op;
+        case 5: /* PITLB: r=0101 */
+          return xtensa_pitlb_op;
+        case 6: /* WITLB: r=0110 */
+          return xtensa_witlb_op;
+        case 7: /* RITLB1: r=0111 */
+          return xtensa_ritlb1_op;
+        case 11: /* RDTLB0: r=1011 */
+          return xtensa_rdtlb0_op;
+        case 12: /* IDTLB: r=1100 */
+          return xtensa_idtlb_op;
+        case 13: /* PDTLB: r=1101 */
+          return xtensa_pdtlb_op;
+        case 14: /* WDTLB: r=1110 */
+          return xtensa_wdtlb_op;
+        }
+        break;
+      case 6: /* RT0: op2=0110 */
+        switch (get_s_field (insn)) {
+        case 0: /* NEG: s=0000 */
+          return xtensa_neg_op;
+        case 1: /* ABS: s=0001 */
+          return xtensa_abs_op;
+        }
+        break;
+      case 9: /* ADDX2: op2=1001 */
+        return xtensa_addx2_op;
+      case 10: /* ADDX4: op2=1010 */
+        return xtensa_addx4_op;
+      case 11: /* ADDX8: op2=1011 */
+        return xtensa_addx8_op;
+      case 12: /* SUB: op2=1100 */
+        return xtensa_sub_op;
+      case 13: /* SUBX2: op2=1101 */
+        return xtensa_subx2_op;
+      case 14: /* SUBX4: op2=1110 */
+        return xtensa_subx4_op;
+      }
+      break;
+    case 1: /* RST1: op1=0001 */
+      switch (get_op2_field (insn)) {
+      case 15: /* IMP: op2=1111 */
+        switch (get_r_field (insn)) {
+        case 0: /* LICT: r=0000 */
+          return xtensa_lict_op;
+        case 1: /* SICT: r=0001 */
+          return xtensa_sict_op;
+        case 2: /* LICW: r=0010 */
+          return xtensa_licw_op;
+        case 3: /* SICW: r=0011 */
+          return xtensa_sicw_op;
+        case 8: /* LDCT: r=1000 */
+          return xtensa_ldct_op;
+        case 9: /* SDCT: r=1001 */
+          return xtensa_sdct_op;
+        }
+        break;
+      case 0: /* SLLI: op2=000x */
+      case 1: /* SLLI: op2=000x */
+        return xtensa_slli_op;
+      case 2: /* SRAI: op2=001x */
+      case 3: /* SRAI: op2=001x */
+        return xtensa_srai_op;
+      case 4: /* SRLI: op2=0100 */
+        return xtensa_srli_op;
+      case 8: /* SRC: op2=1000 */
+        return xtensa_src_op;
+      case 9: /* SRL: op2=1001 */
+        return xtensa_srl_op;
+      case 6: /* XSR: op2=0110 */
+        return xtensa_xsr_op;
+      case 10: /* SLL: op2=1010 */
+        return xtensa_sll_op;
+      case 11: /* SRA: op2=1011 */
+        return xtensa_sra_op;
+      }
+      break;
+    }
+    break;
+  case 1: /* L32R: op0=0001 */
+    return xtensa_l32r_op;
+  case 2: /* LSAI: op0=0010 */
+    switch (get_r_field (insn)) {
+    case 0: /* L8UI: r=0000 */
+      return xtensa_l8ui_op;
+    case 1: /* L16UI: r=0001 */
+      return xtensa_l16ui_op;
+    case 2: /* L32I: r=0010 */
+      return xtensa_l32i_op;
+    case 4: /* S8I: r=0100 */
+      return xtensa_s8i_op;
+    case 5: /* S16I: r=0101 */
+      return xtensa_s16i_op;
+    case 9: /* L16SI: r=1001 */
+      return xtensa_l16si_op;
+    case 6: /* S32I: r=0110 */
+      return xtensa_s32i_op;
+    case 7: /* CACHE: r=0111 */
+      switch (get_t_field (insn)) {
+      case 15: /* III: t=1111 */
+        return xtensa_iii_op;
+      case 0: /* DPFR: t=0000 */
+        return xtensa_dpfr_op;
+      case 1: /* DPFW: t=0001 */
+        return xtensa_dpfw_op;
+      case 2: /* DPFRO: t=0010 */
+        return xtensa_dpfro_op;
+      case 4: /* DHWB: t=0100 */
+        return xtensa_dhwb_op;
+      case 3: /* DPFWO: t=0011 */
+        return xtensa_dpfwo_op;
+      case 8: /* DCE: t=1000 */
+        switch (get_op1_field (insn)) {
+        case 4: /* DIWB: op1=0100 */
+          return xtensa_diwb_op;
+        case 5: /* DIWBI: op1=0101 */
+          return xtensa_diwbi_op;
+        }
+        break;
+      case 5: /* DHWBI: t=0101 */
+        return xtensa_dhwbi_op;
+      case 6: /* DHI: t=0110 */
+        return xtensa_dhi_op;
+      case 7: /* DII: t=0111 */
+        return xtensa_dii_op;
+      case 12: /* IPF: t=1100 */
+        return xtensa_ipf_op;
+      case 14: /* IHI: t=1110 */
+        return xtensa_ihi_op;
+      }
+      break;
+    case 10: /* MOVI: r=1010 */
+      return xtensa_movi_op;
+    case 12: /* ADDI: r=1100 */
+      return xtensa_addi_op;
+    case 13: /* ADDMI: r=1101 */
+      return xtensa_addmi_op;
+    }
+    break;
+  case 8: /* L32I.N: op0=1000 */
+    return xtensa_l32i_n_op;
+  case 5: /* CALL: op0=0101 */
+    switch (get_n_field (insn)) {
+    case 0: /* CALL0: n=00 */
+      return xtensa_call0_op;
+    case 1: /* CALL4: n=01 */
+      return xtensa_call4_op;
+    case 2: /* CALL8: n=10 */
+      return xtensa_call8_op;
+    case 3: /* CALL12: n=11 */
+      return xtensa_call12_op;
+    }
+    break;
+  case 6: /* SI: op0=0110 */
+    switch (get_n_field (insn)) {
+    case 0: /* J: n=00 */
+      return xtensa_j_op;
+    case 1: /* BZ: n=01 */
+      switch (get_m_field (insn)) {
+      case 0: /* BEQZ: m=00 */
+        return xtensa_beqz_op;
+      case 1: /* BNEZ: m=01 */
+        return xtensa_bnez_op;
+      case 2: /* BLTZ: m=10 */
+        return xtensa_bltz_op;
+      case 3: /* BGEZ: m=11 */
+        return xtensa_bgez_op;
+      }
+      break;
+    case 2: /* BI0: n=10 */
+      switch (get_m_field (insn)) {
+      case 0: /* BEQI: m=00 */
+        return xtensa_beqi_op;
+      case 1: /* BNEI: m=01 */
+        return xtensa_bnei_op;
+      case 2: /* BLTI: m=10 */
+        return xtensa_blti_op;
+      case 3: /* BGEI: m=11 */
+        return xtensa_bgei_op;
+      }
+      break;
+    case 3: /* BI1: n=11 */
+      switch (get_m_field (insn)) {
+      case 0: /* ENTRY: m=00 */
+        return xtensa_entry_op;
+      case 1: /* B1: m=01 */
+        switch (get_r_field (insn)) {
+        case 8: /* LOOP: r=1000 */
+          return xtensa_loop_op;
+        case 9: /* LOOPNEZ: r=1001 */
+          return xtensa_loopnez_op;
+        case 10: /* LOOPGTZ: r=1010 */
+          return xtensa_loopgtz_op;
+        }
+        break;
+      case 2: /* BLTUI: m=10 */
+        return xtensa_bltui_op;
+      case 3: /* BGEUI: m=11 */
+        return xtensa_bgeui_op;
+      }
+      break;
+    }
+    break;
+  case 9: /* S32I.N: op0=1001 */
+    return xtensa_s32i_n_op;
+  case 10: /* ADD.N: op0=1010 */
+    return xtensa_add_n_op;
+  case 7: /* B: op0=0111 */
+    switch (get_r_field (insn)) {
+    case 6: /* BBCI: r=011x */
+    case 7: /* BBCI: r=011x */
+      return xtensa_bbci_op;
+    case 0: /* BNONE: r=0000 */
+      return xtensa_bnone_op;
+    case 1: /* BEQ: r=0001 */
+      return xtensa_beq_op;
+    case 2: /* BLT: r=0010 */
+      return xtensa_blt_op;
+    case 4: /* BALL: r=0100 */
+      return xtensa_ball_op;
+    case 14: /* BBSI: r=111x */
+    case 15: /* BBSI: r=111x */
+      return xtensa_bbsi_op;
+    case 3: /* BLTU: r=0011 */
+      return xtensa_bltu_op;
+    case 5: /* BBC: r=0101 */
+      return xtensa_bbc_op;
+    case 8: /* BANY: r=1000 */
+      return xtensa_bany_op;
+    case 9: /* BNE: r=1001 */
+      return xtensa_bne_op;
+    case 10: /* BGE: r=1010 */
+      return xtensa_bge_op;
+    case 11: /* BGEU: r=1011 */
+      return xtensa_bgeu_op;
+    case 12: /* BNALL: r=1100 */
+      return xtensa_bnall_op;
+    case 13: /* BBS: r=1101 */
+      return xtensa_bbs_op;
+    }
+    break;
+  case 11: /* ADDI.N: op0=1011 */
+    return xtensa_addi_n_op;
+  case 12: /* ST2: op0=1100 */
+    switch (get_i_field (insn)) {
+    case 0: /* MOVI.N: i=0 */
+      return xtensa_movi_n_op;
+    case 1: /* BZ6: i=1 */
+      switch (get_z_field (insn)) {
+      case 0: /* BEQZ.N: z=0 */
+        return xtensa_beqz_n_op;
+      case 1: /* BNEZ.N: z=1 */
+        return xtensa_bnez_n_op;
+      }
+      break;
+    }
+    break;
+  case 13: /* ST3: op0=1101 */
+    switch (get_r_field (insn)) {
+    case 15: /* S3: r=1111 */
+      switch (get_t_field (insn)) {
+      case 0: /* RET.N: t=0000 */
+        return xtensa_ret_n_op;
+      case 1: /* RETW.N: t=0001 */
+        return xtensa_retw_n_op;
+      case 2: /* BREAK.N: t=0010 */
+        return xtensa_break_n_op;
+      case 3: /* NOP.N: t=0011 */
+        return xtensa_nop_n_op;
+      }
+      break;
+    case 0: /* MOV.N: r=0000 */
+      return xtensa_mov_n_op;
+    }
+    break;
+  }
+  return XTENSA_UNDEFINED;
+}
+
+int
+interface_version (void)
+{
+  return 3;
+}
+
+static struct config_struct config_table[] = {
+  {"IsaMemoryOrder", "BigEndian"},
+  {"PIFReadDataBits", "128"},
+  {"PIFWriteDataBits", "128"},
+  {"IsaCoprocessorCount", "0"},
+  {"IsaUseBooleans", "0"},
+  {"IsaUseDensityInstruction", "1"},
+  {0, 0}
+};
+
+struct config_struct * get_config_table (void);
+
+struct config_struct *
+get_config_table (void)
+{
+  return config_table;
+}
+
+xtensa_isa_module xtensa_isa_modules[] = {
+  { get_num_opcodes, get_opcodes, decode_insn, get_config_table },
+  { 0, 0, 0, 0 }
 };
diff --git a/config.guess b/config.guess
index 7d0185e..3826ba1 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
-timestamp='2004-09-07'
+timestamp='2004-08-29'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -827,9 +827,6 @@
     crisv32:Linux:*:*)
 	echo crisv32-axis-linux-gnu
 	exit 0 ;;
-    frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
-	exit 0 ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
diff --git a/config/ChangeLog b/config/ChangeLog
index 5e417bd..e935a92 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,20 +1,3 @@
-2004-09-24  Zack Weinberg  <zack@codesourcery.com>
-
-	* warnings.m4: New file.
-
-2004-09-23  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR bootstrap/17369
-	* gcc-lib-path.m4: New file.
-
-2004-09-22  Kelley Cook  <kcook@gcc.gnu.org>
-
-	* gettext-sister.m4: Renamed from gettext.m4
-	* codeset.m4, gettext.m4, glibc21.m4, iconv.m4, intdiv0.m4, po.m4,
-	inttypes.m4, inttypes-pri.m4, inttypes_h.m4, lcmessage.m4, lib-ld.m4,
-	lib-link.m4, lib-prefix.m4, nls.m4, progtest.m4, stdint_h.m4,
-	uintmax_t.m4, ulonglong.m4: Import from gettext-0.12.1 sources.
-
 2004-08-31  Robert Bowdidge <bowdidge@apple.com>
 
 	* mh-ppc-darwin: Add file, and override BOOT_CFLAGS.
diff --git a/config/codeset.m4 b/config/codeset.m4
deleted file mode 100644
index 59535eb..0000000
--- a/config/codeset.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# codeset.m4 serial AM1 (gettext-0.10.40)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_LANGINFO_CODESET],
-[
-  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
-    [AC_TRY_LINK([#include <langinfo.h>],
-      [char* cs = nl_langinfo(CODESET);],
-      am_cv_langinfo_codeset=yes,
-      am_cv_langinfo_codeset=no)
-    ])
-  if test $am_cv_langinfo_codeset = yes; then
-    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
-      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
-  fi
-])
diff --git a/config/gcc-lib-path.m4 b/config/gcc-lib-path.m4
deleted file mode 100644
index 88c4023..0000000
--- a/config/gcc-lib-path.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-AC_DEFUN([TL_AC_GNU_MAKE_GCC_LIB_PATH],
-[
-if test x"$SET_GCC_LIB_PATH_CMD" != x; then
-  # SET_GCC_LIB_PATH_CMD is "XXX=path; export XXX;". It is expanded to
-  #
-  #	eval "set_gcc_lib_path=XXX=path; export XXX;"
-  #
-  eval "set_gcc_lib_path=$SET_GCC_LIB_PATH_CMD"
-  # It will set set_gcc_lib_path to "export XXX=path" for GNU make.
-  set_gcc_lib_path="export $set_gcc_lib_path"
-else
-  set_gcc_lib_path=
-fi
-AC_SUBST(set_gcc_lib_path)
-])dnl
diff --git a/config/gettext-sister.m4 b/config/gettext-sister.m4
deleted file mode 100644
index d10aae8..0000000
--- a/config/gettext-sister.m4
+++ /dev/null
@@ -1,66 +0,0 @@
-# intl sister-directory configuration rules.
-#
-
-# The idea behind this macro is that there's no need to repeat all the
-# autoconf probes done by the intl directory - it's already done them
-# for us.  In fact, there's no need even to look at the cache for the
-# answers.  All we need to do is nab a few pieces of information.
-# The intl directory is set up to make this easy, by generating a
-# small file which can be sourced as a shell script; then we produce
-# the necessary substitutions and definitions for this directory.
-
-AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
-[# If we haven't got the data from the intl directory,
-# assume NLS is disabled.
-USE_NLS=no	AC_SUBST(USE_NLS)
-LIBINTL=	AC_SUBST(LIBINTL)
-LIBINTL_DEP=	AC_SUBST(LIBINTL_DEP)
-INCINTL=	AC_SUBST(INCINTL)
-XGETTEXT=	AC_SUBST(XGETTEXT)
-GMSGFMT=	AC_SUBST(GMSGFMT)
-POSUB=		AC_SUBST(POSUB)
-if test -f ../intl/config.intl; then
-  . ../intl/config.intl
-fi
-AC_MSG_CHECKING([whether NLS is requested])
-if test x"$USE_NLS" != xyes; then
-  AC_MSG_RESULT(no)
-else
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(ENABLE_NLS, 1, 
- [Define to 1 if translation of program messages to the 
-  user's native language is requested.])
-
-  AC_MSG_CHECKING(for catalogs to be installed)
-  # Look for .po and .gmo files in the source directory.
-  CATALOGS=  AC_SUBST(CATALOGS)
-  XLINGUAS=
-  for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
-    # If there aren't any .gmo files the shell will give us the
-    # literal string "../path/to/srcdir/po/*.gmo" which has to be
-    # weeded out.
-    case "$cat" in *\**)
-      continue;;
-    esac
-    # The quadruple backslash is collapsed to a double backslash
-    # by the backticks, then collapsed again by the double quotes,
-    # leaving us with one backslash in the sed expression (right
-    # before the dot that mustn't act as a wildcard).
-    cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"`
-    lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"`
-    # The user is allowed to set LINGUAS to a list of languages to
-    # install catalogs for.  If it's empty that means "all of them."
-    if test "x$LINGUAS" = x; then
-      CATALOGS="$CATALOGS $cat"
-      XLINGUAS="$XLINGUAS $lang"
-    else
-      case "$LINGUAS" in *$lang*)
-        CATALOGS="$CATALOGS $cat"
-        XLINGUAS="$XLINGUAS $lang"
-        ;;
-      esac
-    fi
-  done
-  LINGUAS="$XLINGUAS"
-  AC_MSG_RESULT($LINGUAS)
-fi])
diff --git a/config/gettext.m4 b/config/gettext.m4
index 16070b4..d10aae8 100644
--- a/config/gettext.m4
+++ b/config/gettext.m4
@@ -1,415 +1,66 @@
-# gettext.m4 serial 20 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
+# intl sister-directory configuration rules.
+#
 
-dnl Authors:
-dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+# The idea behind this macro is that there's no need to repeat all the
+# autoconf probes done by the intl directory - it's already done them
+# for us.  In fact, there's no need even to look at the cache for the
+# answers.  All we need to do is nab a few pieces of information.
+# The intl directory is set up to make this easy, by generating a
+# small file which can be sourced as a shell script; then we produce
+# the necessary substitutions and definitions for this directory.
 
-dnl Macro to add for using GNU gettext.
+AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
+[# If we haven't got the data from the intl directory,
+# assume NLS is disabled.
+USE_NLS=no	AC_SUBST(USE_NLS)
+LIBINTL=	AC_SUBST(LIBINTL)
+LIBINTL_DEP=	AC_SUBST(LIBINTL_DEP)
+INCINTL=	AC_SUBST(INCINTL)
+XGETTEXT=	AC_SUBST(XGETTEXT)
+GMSGFMT=	AC_SUBST(GMSGFMT)
+POSUB=		AC_SUBST(POSUB)
+if test -f ../intl/config.intl; then
+  . ../intl/config.intl
+fi
+AC_MSG_CHECKING([whether NLS is requested])
+if test x"$USE_NLS" != xyes; then
+  AC_MSG_RESULT(no)
+else
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(ENABLE_NLS, 1, 
+ [Define to 1 if translation of program messages to the 
+  user's native language is requested.])
 
-dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
-dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
-dnl    default (if it is not specified or empty) is 'no-libtool'.
-dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
-dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
-dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
-dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
-dnl    depending on --{enable,disable}-{shared,static} and on the presence of
-dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
-dnl    $(top_builddir)/intl/libintl.a will be created.
-dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
-dnl    implementations (in libc or libintl) without the ngettext() function
-dnl    will be ignored.  If NEEDSYMBOL is specified and is
-dnl    'need-formatstring-macros', then GNU gettext implementations that don't
-dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
-dnl INTLDIR is used to find the intl libraries.  If empty,
-dnl    the value `$(top_builddir)/intl/' is used.
-dnl
-dnl The result of the configuration is one of three cases:
-dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
-dnl    and used.
-dnl    Catalog format: GNU --> install in $(datadir)
-dnl    Catalog extension: .mo after installation, .gmo in source tree
-dnl 2) GNU gettext has been found in the system's C library.
-dnl    Catalog format: GNU --> install in $(datadir)
-dnl    Catalog extension: .mo after installation, .gmo in source tree
-dnl 3) No internationalization, always use English msgid.
-dnl    Catalog format: none
-dnl    Catalog extension: none
-dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
-dnl The use of .gmo is historical (it was needed to avoid overwriting the
-dnl GNU format catalogs when building on a platform with an X/Open gettext),
-dnl but we keep it in order not to force irrelevant filename changes on the
-dnl maintainers.
-dnl
-AC_DEFUN([AM_GNU_GETTEXT],
-[
-  dnl Argument checking.
-  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
-    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
-])])])])])
-  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
-    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
-])])])])
-  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
-  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
-
-  AC_REQUIRE([AM_PO_SUBDIRS])dnl
-  ifelse(gt_included_intl, yes, [
-    AC_REQUIRE([AM_INTL_SUBDIR])dnl
-  ])
-
-  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
-  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-  AC_REQUIRE([AC_LIB_RPATH])
-
-  dnl Sometimes libintl requires libiconv, so first search for libiconv.
-  dnl Ideally we would do this search only after the
-  dnl      if test "$USE_NLS" = "yes"; then
-  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
-  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
-  dnl the configure script would need to contain the same shell code
-  dnl again, outside any 'if'. There are two solutions:
-  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
-  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
-  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
-  dnl documented, we avoid it.
-  ifelse(gt_included_intl, yes, , [
-    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-  ])
-
-  dnl Set USE_NLS.
-  AM_NLS
-
-  ifelse(gt_included_intl, yes, [
-    BUILD_INCLUDED_LIBINTL=no
-    USE_INCLUDED_LIBINTL=no
-  ])
-  LIBINTL=
-  LTLIBINTL=
-  POSUB=
-
-  dnl If we use NLS figure out what method
-  if test "$USE_NLS" = "yes"; then
-    gt_use_preinstalled_gnugettext=no
-    ifelse(gt_included_intl, yes, [
-      AC_MSG_CHECKING([whether included gettext is requested])
-      AC_ARG_WITH(included-gettext,
-        [  --with-included-gettext use the GNU gettext library included here],
-        nls_cv_force_use_gnu_gettext=$withval,
-        nls_cv_force_use_gnu_gettext=no)
-      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
-
-      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
-      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
-    ])
-        dnl User does not insist on using GNU NLS library.  Figure out what
-        dnl to use.  If GNU gettext is available we use this.  Else we have
-        dnl to fall back to GNU NLS library.
-
-        dnl Add a version number to the cache macros.
-        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
-        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
-        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
-
-        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
-         [AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;],
-            [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
-            gt_cv_func_gnugettext_libc=yes,
-            gt_cv_func_gnugettext_libc=no)])
-
-        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
-          dnl Sometimes libintl requires libiconv, so first search for libiconv.
-          ifelse(gt_included_intl, yes, , [
-            AM_ICONV_LINK
-          ])
-          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
-          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
-          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
-          dnl even if libiconv doesn't exist.
-          AC_LIB_LINKFLAGS_BODY([intl])
-          AC_CACHE_CHECK([for GNU gettext in libintl],
-            gt_cv_func_gnugettext_libintl,
-           [gt_save_CPPFLAGS="$CPPFLAGS"
-            CPPFLAGS="$CPPFLAGS $INCINTL"
-            gt_save_LIBS="$LIBS"
-            LIBS="$LIBS $LIBINTL"
-            dnl Now see whether libintl exists and does not depend on libiconv.
-            AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
-              [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
-              gt_cv_func_gnugettext_libintl=yes,
-              gt_cv_func_gnugettext_libintl=no)
-            dnl Now see whether libintl exists and depends on libiconv.
-            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
-              LIBS="$LIBS $LIBICONV"
-              AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
-                [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
-               [LIBINTL="$LIBINTL $LIBICONV"
-                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
-                gt_cv_func_gnugettext_libintl=yes
-               ])
-            fi
-            CPPFLAGS="$gt_save_CPPFLAGS"
-            LIBS="$gt_save_LIBS"])
-        fi
-
-        dnl If an already present or preinstalled GNU gettext() is found,
-        dnl use it.  But if this macro is used in GNU gettext, and GNU
-        dnl gettext is already preinstalled in libintl, we update this
-        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
-        if test "$gt_cv_func_gnugettext_libc" = "yes" \
-           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
-                && test "$PACKAGE" != gettext-runtime \
-                && test "$PACKAGE" != gettext-tools; }; then
-          gt_use_preinstalled_gnugettext=yes
-        else
-          dnl Reset the values set by searching for libintl.
-          LIBINTL=
-          LTLIBINTL=
-          INCINTL=
-        fi
-
-    ifelse(gt_included_intl, yes, [
-        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
-          dnl GNU gettext is not found in the C library.
-          dnl Fall back on included GNU gettext library.
-          nls_cv_use_gnu_gettext=yes
-        fi
-      fi
-
-      if test "$nls_cv_use_gnu_gettext" = "yes"; then
-        dnl Mark actions used to generate GNU NLS library.
-        BUILD_INCLUDED_LIBINTL=yes
-        USE_INCLUDED_LIBINTL=yes
-        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
-        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
-        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
-      fi
-
-      if test "$gt_use_preinstalled_gnugettext" = "yes" \
-         || test "$nls_cv_use_gnu_gettext" = "yes"; then
-        dnl Mark actions to use GNU gettext tools.
-        CATOBJEXT=.gmo
-      fi
-    ])
-
-    if test "$gt_use_preinstalled_gnugettext" = "yes" \
-       || test "$nls_cv_use_gnu_gettext" = "yes"; then
-      AC_DEFINE(ENABLE_NLS, 1,
-        [Define to 1 if translation of program messages to the user's native language
-   is requested.])
-    else
-      USE_NLS=no
-    fi
-  fi
-
-  AC_MSG_CHECKING([whether to use NLS])
-  AC_MSG_RESULT([$USE_NLS])
-  if test "$USE_NLS" = "yes"; then
-    AC_MSG_CHECKING([where the gettext function comes from])
-    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
-        gt_source="external libintl"
-      else
-        gt_source="libc"
-      fi
-    else
-      gt_source="included intl directory"
-    fi
-    AC_MSG_RESULT([$gt_source])
-  fi
-
-  if test "$USE_NLS" = "yes"; then
-
-    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
-        AC_MSG_CHECKING([how to link with libintl])
-        AC_MSG_RESULT([$LIBINTL])
-        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
-      fi
-
-      dnl For backward compatibility. Some packages may be using this.
-      AC_DEFINE(HAVE_GETTEXT, 1,
-       [Define if the GNU gettext() function is already present or preinstalled.])
-      AC_DEFINE(HAVE_DCGETTEXT, 1,
-       [Define if the GNU dcgettext() function is already present or preinstalled.])
-    fi
-
-    dnl We need to process the po/ directory.
-    POSUB=po
-  fi
-
-  ifelse(gt_included_intl, yes, [
-    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
-    dnl to 'yes' because some of the testsuite requires it.
-    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
-      BUILD_INCLUDED_LIBINTL=yes
-    fi
-
-    dnl Make all variables we use known to autoconf.
-    AC_SUBST(BUILD_INCLUDED_LIBINTL)
-    AC_SUBST(USE_INCLUDED_LIBINTL)
-    AC_SUBST(CATOBJEXT)
-
-    dnl For backward compatibility. Some configure.ins may be using this.
-    nls_cv_header_intl=
-    nls_cv_header_libgt=
-
-    dnl For backward compatibility. Some Makefiles may be using this.
-    DATADIRNAME=share
-    AC_SUBST(DATADIRNAME)
-
-    dnl For backward compatibility. Some Makefiles may be using this.
-    INSTOBJEXT=.mo
-    AC_SUBST(INSTOBJEXT)
-
-    dnl For backward compatibility. Some Makefiles may be using this.
-    GENCAT=gencat
-    AC_SUBST(GENCAT)
-
-    dnl For backward compatibility. Some Makefiles may be using this.
-    if test "$USE_INCLUDED_LIBINTL" = yes; then
-      INTLOBJS="\$(GETTOBJS)"
-    fi
-    AC_SUBST(INTLOBJS)
-
-    dnl Enable libtool support if the surrounding package wishes it.
-    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
-    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
-  ])
-
-  dnl For backward compatibility. Some Makefiles may be using this.
-  INTLLIBS="$LIBINTL"
-  AC_SUBST(INTLLIBS)
-
-  dnl Make all documented variables known to autoconf.
-  AC_SUBST(LIBINTL)
-  AC_SUBST(LTLIBINTL)
-  AC_SUBST(POSUB)
-])
-
-
-dnl Checks for all prerequisites of the intl subdirectory,
-dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
-dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
-AC_DEFUN([AM_INTL_SUBDIR],
-[
-  AC_REQUIRE([AC_PROG_INSTALL])dnl
-  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
-  AC_REQUIRE([AC_PROG_CC])dnl
-  AC_REQUIRE([AC_CANONICAL_HOST])dnl
-  AC_REQUIRE([AC_PROG_RANLIB])dnl
-  AC_REQUIRE([AC_ISC_POSIX])dnl
-  AC_REQUIRE([AC_HEADER_STDC])dnl
-  AC_REQUIRE([AC_C_CONST])dnl
-  AC_REQUIRE([AC_C_INLINE])dnl
-  AC_REQUIRE([AC_TYPE_OFF_T])dnl
-  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
-  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
-  AC_REQUIRE([AC_FUNC_MMAP])dnl
-  AC_REQUIRE([jm_GLIBC21])dnl
-  AC_REQUIRE([gt_INTDIV0])dnl
-  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
-  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
-  AC_REQUIRE([gt_INTTYPES_PRI])dnl
-
-  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
-stdlib.h string.h unistd.h sys/param.h])
-  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
-geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
-strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
-__fsetlocking])
-
-  AM_ICONV
-  AM_LANGINFO_CODESET
-  if test $ac_cv_header_locale_h = yes; then
-    AM_LC_MESSAGES
-  fi
-
-  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
-  dnl because plural.y uses bison specific features. It requires at least
-  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
-  dnl compile.
-  dnl bison is only needed for the maintainer (who touches plural.y). But in
-  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
-  dnl the rule in general Makefile. Now, some people carelessly touch the
-  dnl files or have a broken "make" program, hence the plural.c rule will
-  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
-  dnl present or too old.
-  AC_CHECK_PROGS([INTLBISON], [bison])
-  if test -z "$INTLBISON"; then
-    ac_verc_fail=yes
-  else
-    dnl Found it, now check the version.
-    AC_MSG_CHECKING([version of bison])
-changequote(<<,>>)dnl
-    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
-    case $ac_prog_version in
-      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
-      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
-changequote([,])dnl
-         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
-      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+  AC_MSG_CHECKING(for catalogs to be installed)
+  # Look for .po and .gmo files in the source directory.
+  CATALOGS=  AC_SUBST(CATALOGS)
+  XLINGUAS=
+  for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
+    # If there aren't any .gmo files the shell will give us the
+    # literal string "../path/to/srcdir/po/*.gmo" which has to be
+    # weeded out.
+    case "$cat" in *\**)
+      continue;;
     esac
-    AC_MSG_RESULT([$ac_prog_version])
-  fi
-  if test $ac_verc_fail = yes; then
-    INTLBISON=:
-  fi
-])
-
-
-dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
-AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
+    # The quadruple backslash is collapsed to a double backslash
+    # by the backticks, then collapsed again by the double quotes,
+    # leaving us with one backslash in the sed expression (right
+    # before the dot that mustn't act as a wildcard).
+    cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"`
+    lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"`
+    # The user is allowed to set LINGUAS to a list of languages to
+    # install catalogs for.  If it's empty that means "all of them."
+    if test "x$LINGUAS" = x; then
+      CATALOGS="$CATALOGS $cat"
+      XLINGUAS="$XLINGUAS $lang"
+    else
+      case "$LINGUAS" in *$lang*)
+        CATALOGS="$CATALOGS $cat"
+        XLINGUAS="$XLINGUAS $lang"
+        ;;
+      esac
+    fi
+  done
+  LINGUAS="$XLINGUAS"
+  AC_MSG_RESULT($LINGUAS)
+fi])
diff --git a/config/glibc21.m4 b/config/glibc21.m4
deleted file mode 100644
index 9c9f3db..0000000
--- a/config/glibc21.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-# Test for the GNU C Library, version 2.1 or newer.
-# From Bruno Haible.
-
-AC_DEFUN([jm_GLIBC21],
-  [
-    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
-      ac_cv_gnu_library_2_1,
-      [AC_EGREP_CPP([Lucky GNU user],
-	[
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
-  Lucky GNU user
- #endif
-#endif
-	],
-	ac_cv_gnu_library_2_1=yes,
-	ac_cv_gnu_library_2_1=no)
-      ]
-    )
-    AC_SUBST(GLIBC21)
-    GLIBC21="$ac_cv_gnu_library_2_1"
-  ]
-)
diff --git a/config/iconv.m4 b/config/iconv.m4
deleted file mode 100644
index c5f3579..0000000
--- a/config/iconv.m4
+++ /dev/null
@@ -1,103 +0,0 @@
-# iconv.m4 serial AM4 (gettext-0.11.3)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
-[
-  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
-  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-  AC_REQUIRE([AC_LIB_RPATH])
-
-  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
-  dnl accordingly.
-  AC_LIB_LINKFLAGS_BODY([iconv])
-])
-
-AC_DEFUN([AM_ICONV_LINK],
-[
-  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
-  dnl those with the standalone portable GNU libiconv installed).
-
-  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
-  dnl accordingly.
-  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-
-  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
-  dnl because if the user has installed libiconv and not disabled its use
-  dnl via --without-libiconv-prefix, he wants to use it. The first
-  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
-  am_save_CPPFLAGS="$CPPFLAGS"
-  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
-
-  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
-    am_cv_func_iconv="no, consider installing GNU libiconv"
-    am_cv_lib_iconv=no
-    AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
-      [iconv_t cd = iconv_open("","");
-       iconv(cd,NULL,NULL,NULL,NULL);
-       iconv_close(cd);],
-      am_cv_func_iconv=yes)
-    if test "$am_cv_func_iconv" != yes; then
-      am_save_LIBS="$LIBS"
-      LIBS="$LIBS $LIBICONV"
-      AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
-        [iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);],
-        am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes)
-      LIBS="$am_save_LIBS"
-    fi
-  ])
-  if test "$am_cv_func_iconv" = yes; then
-    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
-  fi
-  if test "$am_cv_lib_iconv" = yes; then
-    AC_MSG_CHECKING([how to link with libiconv])
-    AC_MSG_RESULT([$LIBICONV])
-  else
-    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
-    dnl either.
-    CPPFLAGS="$am_save_CPPFLAGS"
-    LIBICONV=
-    LTLIBICONV=
-  fi
-  AC_SUBST(LIBICONV)
-  AC_SUBST(LTLIBICONV)
-])
-
-AC_DEFUN([AM_ICONV],
-[
-  AM_ICONV_LINK
-  if test "$am_cv_func_iconv" = yes; then
-    AC_MSG_CHECKING([for iconv declaration])
-    AC_CACHE_VAL(am_cv_proto_iconv, [
-      AC_TRY_COMPILE([
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
-      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
-    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    AC_MSG_RESULT([$]{ac_t:-
-         }[$]am_cv_proto_iconv)
-    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
-      [Define as const if the declaration of iconv() needs const.])
-  fi
-])
diff --git a/config/intdiv0.m4 b/config/intdiv0.m4
deleted file mode 100644
index 55dddcf..0000000
--- a/config/intdiv0.m4
+++ /dev/null
@@ -1,72 +0,0 @@
-# intdiv0.m4 serial 1 (gettext-0.11.3)
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gt_INTDIV0],
-[
-  AC_REQUIRE([AC_PROG_CC])dnl
-  AC_REQUIRE([AC_CANONICAL_HOST])dnl
-
-  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
-    gt_cv_int_divbyzero_sigfpe,
-    [
-      AC_TRY_RUN([
-#include <stdlib.h>
-#include <signal.h>
-
-static void
-#ifdef __cplusplus
-sigfpe_handler (int sig)
-#else
-sigfpe_handler (sig) int sig;
-#endif
-{
-  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
-  exit (sig != SIGFPE);
-}
-
-int x = 1;
-int y = 0;
-int z;
-int nan;
-
-int main ()
-{
-  signal (SIGFPE, sigfpe_handler);
-/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
-#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
-  signal (SIGTRAP, sigfpe_handler);
-#endif
-/* Linux/SPARC yields signal SIGILL.  */
-#if defined (__sparc__) && defined (__linux__)
-  signal (SIGILL, sigfpe_handler);
-#endif
-
-  z = x / y;
-  nan = y / y;
-  exit (1);
-}
-], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
-        [
-          # Guess based on the CPU.
-          case "$host_cpu" in
-            alpha* | i[34567]86 | m68k | s390*)
-              gt_cv_int_divbyzero_sigfpe="guessing yes";;
-            *)
-              gt_cv_int_divbyzero_sigfpe="guessing no";;
-          esac
-        ])
-    ])
-  case "$gt_cv_int_divbyzero_sigfpe" in
-    *yes) value=1;;
-    *) value=0;;
-  esac
-  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
-    [Define if integer division by zero raises signal SIGFPE.])
-])
diff --git a/config/inttypes-pri.m4 b/config/inttypes-pri.m4
deleted file mode 100644
index fd007c3..0000000
--- a/config/inttypes-pri.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# inttypes-pri.m4 serial 1 (gettext-0.11.4)
-dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
-# macros to non-string values.  This is the case on AIX 4.3.3.
-
-AC_DEFUN([gt_INTTYPES_PRI],
-[
-  AC_REQUIRE([gt_HEADER_INTTYPES_H])
-  if test $gt_cv_header_inttypes_h = yes; then
-    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
-      gt_cv_inttypes_pri_broken,
-      [
-        AC_TRY_COMPILE([#include <inttypes.h>
-#ifdef PRId32
-char *p = PRId32;
-#endif
-], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
-      ])
-  fi
-  if test "$gt_cv_inttypes_pri_broken" = yes; then
-    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
-      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
-  fi
-])
diff --git a/config/inttypes.m4 b/config/inttypes.m4
deleted file mode 100644
index ab370ff..0000000
--- a/config/inttypes.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-# inttypes.m4 serial 1 (gettext-0.11.4)
-dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
-# <sys/types.h>.
-
-AC_DEFUN([gt_HEADER_INTTYPES_H],
-[
-  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
-  [
-    AC_TRY_COMPILE(
-      [#include <sys/types.h>
-#include <inttypes.h>],
-      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
-  ])
-  if test $gt_cv_header_inttypes_h = yes; then
-    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
-      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
-  fi
-])
diff --git a/config/inttypes_h.m4 b/config/inttypes_h.m4
deleted file mode 100644
index f342eba..0000000
--- a/config/inttypes_h.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-# inttypes_h.m4 serial 5 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
-[
-  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
-  [AC_TRY_COMPILE(
-    [#include <sys/types.h>
-#include <inttypes.h>],
-    [uintmax_t i = (uintmax_t) -1;],
-    jm_ac_cv_header_inttypes_h=yes,
-    jm_ac_cv_header_inttypes_h=no)])
-  if test $jm_ac_cv_header_inttypes_h = yes; then
-    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
-      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
-       and declares uintmax_t. ])
-  fi
-])
diff --git a/config/lcmessage.m4 b/config/lcmessage.m4
deleted file mode 100644
index ffd4008..0000000
--- a/config/lcmessage.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# lcmessage.m4 serial 3 (gettext-0.11.3)
-dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
-
-# Check whether LC_MESSAGES is available in <locale.h>.
-
-AC_DEFUN([AM_LC_MESSAGES],
-[
-  AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
-    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
-       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
-  if test $am_cv_val_LC_MESSAGES = yes; then
-    AC_DEFINE(HAVE_LC_MESSAGES, 1,
-      [Define if your <locale.h> file defines LC_MESSAGES.])
-  fi
-])
diff --git a/config/lib-ld.m4 b/config/lib-ld.m4
deleted file mode 100644
index 11d0ce7..0000000
--- a/config/lib-ld.m4
+++ /dev/null
@@ -1,110 +0,0 @@
-# lib-ld.m4 serial 2 (gettext-0.12)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
-
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
-AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
-  acl_cv_prog_gnu_ld=yes
-else
-  acl_cv_prog_gnu_ld=no
-fi])
-with_gnu_ld=$acl_cv_prog_gnu_ld
-])
-
-dnl From libtool-1.4. Sets the variable LD.
-AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
-[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by GCC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]* | [A-Za-z]:[\\/]*)]
-      [re_direlt='/[^/][^/]*/\.\./']
-      # Canonicalize the path of ld
-      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(acl_cv_path_LD,
-[if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      acl_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
-	test "$with_gnu_ld" != no && break
-      else
-	test "$with_gnu_ld" != yes && break
-      fi
-    fi
-  done
-  IFS="$ac_save_ifs"
-else
-  acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_LIB_PROG_LD_GNU
-])
diff --git a/config/lib-link.m4 b/config/lib-link.m4
deleted file mode 100644
index eeb200d..0000000
--- a/config/lib-link.m4
+++ /dev/null
@@ -1,551 +0,0 @@
-# lib-link.m4 serial 4 (gettext-0.12)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
-dnl augments the CPPFLAGS variable.
-AC_DEFUN([AC_LIB_LINKFLAGS],
-[
-  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-  AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
-    AC_LIB_LINKFLAGS_BODY([$1], [$2])
-    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
-    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
-    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
-  ])
-  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
-  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
-  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
-  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-  AC_SUBST([LIB]NAME)
-  AC_SUBST([LTLIB]NAME)
-  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
-  dnl results of this search when this library appears as a dependency.
-  HAVE_LIB[]NAME=yes
-  undefine([Name])
-  undefine([NAME])
-])
-
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
-dnl searches for libname and the libraries corresponding to explicit and
-dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. If found, it
-dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
-dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
-dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
-dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
-[
-  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-  AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-
-  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
-  dnl accordingly.
-  AC_LIB_LINKFLAGS_BODY([$1], [$2])
-
-  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
-  dnl because if the user has installed lib[]Name and not disabled its use
-  dnl via --without-lib[]Name-prefix, he wants to use it.
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-
-  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
-    ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIB[]NAME"
-    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
-    LIBS="$ac_save_LIBS"
-  ])
-  if test "$ac_cv_lib[]Name" = yes; then
-    HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
-    AC_MSG_CHECKING([how to link with lib[]$1])
-    AC_MSG_RESULT([$LIB[]NAME])
-  else
-    HAVE_LIB[]NAME=no
-    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
-    dnl $INC[]NAME either.
-    CPPFLAGS="$ac_save_CPPFLAGS"
-    LIB[]NAME=
-    LTLIB[]NAME=
-  fi
-  AC_SUBST([HAVE_LIB]NAME)
-  AC_SUBST([LIB]NAME)
-  AC_SUBST([LTLIB]NAME)
-  undefine([Name])
-  undefine([NAME])
-])
-
-dnl Determine the platform dependent parameters needed to use rpath:
-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
-dnl hardcode_direct, hardcode_minus_L.
-AC_DEFUN([AC_LIB_RPATH],
-[
-  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
-  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
-  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
-  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
-  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
-    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
-    . ./conftest.sh
-    rm -f ./conftest.sh
-    acl_cv_rpath=done
-  ])
-  wl="$acl_cv_wl"
-  libext="$acl_cv_libext"
-  shlibext="$acl_cv_shlibext"
-  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-  hardcode_direct="$acl_cv_hardcode_direct"
-  hardcode_minus_L="$acl_cv_hardcode_minus_L"
-  dnl Determine whether the user wants rpath handling at all.
-  AC_ARG_ENABLE(rpath,
-    [  --disable-rpath         do not hardcode runtime library paths],
-    :, enable_rpath=yes)
-])
-
-dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
-[
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-  dnl By default, look in $includedir and $libdir.
-  use_additional=yes
-  AC_LIB_WITH_FINAL_PREFIX([
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
-  ])
-  AC_LIB_ARG_WITH([lib$1-prefix],
-[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
-  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
-[
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
-        AC_LIB_WITH_FINAL_PREFIX([
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
-        ])
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/lib"
-      fi
-    fi
-])
-  dnl Search the library and its dependencies in $additional_libdir and
-  dnl $LDFLAGS. Using breadth-first-seach.
-  LIB[]NAME=
-  LTLIB[]NAME=
-  INC[]NAME=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='$1 $2'
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
-        dnl or AC_LIB_HAVE_LINKFLAGS call.
-        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
-          else
-            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
-            dnl that this library doesn't exist. So just drop it.
-            :
-          fi
-        else
-          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
-          dnl and the already constructed $LIBNAME/$LTLIBNAME.
-          found_dir=
-          found_la=
-          found_so=
-          found_a=
-          if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            else
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
-                fi
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIB[]NAME; do
-              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  else
-                    if test -f "$dir/lib$name.$libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
-                      fi
-                    fi
-                  fi
-                  ;;
-              esac
-              if test "X$found_dir" != "X"; then
-                break
-              fi
-            done
-          fi
-          if test "X$found_dir" != "X"; then
-            dnl Found the library.
-            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
-            if test "X$found_so" != "X"; then
-              dnl Linking with a shared library. We attempt to hardcode its
-              dnl directory into the executable's runpath, unless it's the
-              dnl standard /usr/lib.
-              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
-                dnl No hardcoding is needed.
-                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-              else
-                dnl Use an explicit option to hardcode DIR into the resulting
-                dnl binary.
-                dnl Potentially add DIR to ltrpathdirs.
-                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
-                haveit=
-                for x in $ltrpathdirs; do
-                  if test "X$x" = "X$found_dir"; then
-                    haveit=yes
-                    break
-                  fi
-                done
-                if test -z "$haveit"; then
-                  ltrpathdirs="$ltrpathdirs $found_dir"
-                fi
-                dnl The hardcoding into $LIBNAME is system dependent.
-                if test "$hardcode_direct" = yes; then
-                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
-                  dnl resulting binary.
-                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-                else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-                    dnl Use an explicit option to hardcode DIR into the resulting
-                    dnl binary.
-                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-                    dnl Potentially add DIR to rpathdirs.
-                    dnl The rpathdirs will be appended to $LIBNAME at the end.
-                    haveit=
-                    for x in $rpathdirs; do
-                      if test "X$x" = "X$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
-                    fi
-                  else
-                    dnl Rely on "-L$found_dir".
-                    dnl But don't add it if it's already contained in the LDFLAGS
-                    dnl or the already constructed $LIBNAME
-                    haveit=
-                    for x in $LDFLAGS $LIB[]NAME; do
-                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
-                    fi
-                    if test "$hardcode_minus_L" != no; then
-                      dnl FIXME: Not sure whether we should use
-                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
-                      dnl here.
-                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-                    else
-                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
-                      dnl here, because this doesn't fit in flags passed to the
-                      dnl compiler. So give up. No hardcoding. This affects only
-                      dnl very old systems.
-                      dnl FIXME: Not sure whether we should use
-                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
-                      dnl here.
-                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                dnl Linking with a static library.
-                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
-              else
-                dnl We shouldn't come here, but anyway it's good to have a
-                dnl fallback.
-                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
-              fi
-            fi
-            dnl Assume the include files are nearby.
-            additional_includedir=
-            case "$found_dir" in
-              */lib | */lib/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-              dnl Potentially add $additional_includedir to $INCNAME.
-              dnl But don't add it
-              dnl   1. if it's the standard /usr/include,
-              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
-              dnl   3. if it's already present in $CPPFLAGS or the already
-              dnl      constructed $INCNAME,
-              dnl   4. if it doesn't exist as a directory.
-              if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux*) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INC[]NAME; do
-                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                      dnl Really add $additional_includedir to $INCNAME.
-                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-            dnl Look for dependencies.
-            if test -n "$found_la"; then
-              dnl Read the .la file. It defines the variables
-              dnl dlname, library_names, old_library, dependency_libs, current,
-              dnl age, revision, installed, dlopen, dlpreopen, libdir.
-              save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-              dnl We use only dependency_libs.
-              for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
-                    dnl But don't add it
-                    dnl   1. if it's the standard /usr/lib,
-                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
-                    dnl   3. if it's already present in $LDFLAGS or the already
-                    dnl      constructed $LIBNAME,
-                    dnl   4. if it doesn't exist as a directory.
-                    if test "X$additional_libdir" != "X/usr/lib"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/lib"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux*) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIB[]NAME; do
-                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                            dnl Really add $additional_libdir to $LIBNAME.
-                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIB[]NAME; do
-                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                            dnl Really add $additional_libdir to $LTLIBNAME.
-                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                      dnl Potentially add DIR to rpathdirs.
-                      dnl The rpathdirs will be appended to $LIBNAME at the end.
-                      haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                      dnl Potentially add DIR to ltrpathdirs.
-                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
-                      haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                    dnl Handle this in the next round.
-                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                    dnl Handle this in the next round. Throw away the .la's
-                    dnl directory; it is already contained in a preceding -L
-                    dnl option.
-                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                    dnl Most likely an immediate library name.
-                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
-                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-            dnl Didn't find the library; assume it is in the system directories
-            dnl known to the linker and runtime loader. (All the system
-            dnl directories known to the linker should also be known to the
-            dnl runtime loader, otherwise the system is severely misconfigured.)
-            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
-            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
-      dnl Weird platform: only the last -rpath option counts, the user must
-      dnl pass all path elements in one option. We can arrange that for a
-      dnl single library, but not when more than one $LIBNAMEs are used.
-      alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-      done
-      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
-      acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
-    else
-      dnl The -rpath options are cumulative.
-      for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-    dnl When using libtool, the option that works for both libraries and
-    dnl executables is -R. The -R options are cumulative.
-    for found_dir in $ltrpathdirs; do
-      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
-    done
-  fi
-])
-
-dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
-dnl unless already present in VAR.
-dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
-dnl contains two or three consecutive elements that belong together.
-AC_DEFUN([AC_LIB_APPENDTOVAR],
-[
-  for element in [$2]; do
-    haveit=
-    for x in $[$1]; do
-      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      [$1]="${[$1]}${[$1]:+ }$element"
-    fi
-  done
-])
diff --git a/config/lib-prefix.m4 b/config/lib-prefix.m4
deleted file mode 100644
index c719bc8..0000000
--- a/config/lib-prefix.m4
+++ /dev/null
@@ -1,155 +0,0 @@
-# lib-prefix.m4 serial 2 (gettext-0.12)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
-dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
-dnl require excessive bracketing.
-ifdef([AC_HELP_STRING],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
-
-dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
-dnl to access previously installed libraries. The basic assumption is that
-dnl a user will want packages to use other packages he previously installed
-dnl with the same --prefix option.
-dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
-dnl libraries, but is otherwise very convenient.
-AC_DEFUN([AC_LIB_PREFIX],
-[
-  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
-  AC_REQUIRE([AC_PROG_CC])
-  AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-  dnl By default, look in $includedir and $libdir.
-  use_additional=yes
-  AC_LIB_WITH_FINAL_PREFIX([
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
-  ])
-  AC_LIB_ARG_WITH([lib-prefix],
-[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
-  --without-lib-prefix    don't search for libraries in includedir and libdir],
-[
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
-        AC_LIB_WITH_FINAL_PREFIX([
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
-        ])
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/lib"
-      fi
-    fi
-])
-  if test $use_additional = yes; then
-    dnl Potentially add $additional_includedir to $CPPFLAGS.
-    dnl But don't add it
-    dnl   1. if it's the standard /usr/include,
-    dnl   2. if it's already present in $CPPFLAGS,
-    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
-    dnl   4. if it doesn't exist as a directory.
-    if test "X$additional_includedir" != "X/usr/include"; then
-      haveit=
-      for x in $CPPFLAGS; do
-        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-        if test "X$x" = "X-I$additional_includedir"; then
-          haveit=yes
-          break
-        fi
-      done
-      if test -z "$haveit"; then
-        if test "X$additional_includedir" = "X/usr/local/include"; then
-          if test -n "$GCC"; then
-            case $host_os in
-              linux*) haveit=yes;;
-            esac
-          fi
-        fi
-        if test -z "$haveit"; then
-          if test -d "$additional_includedir"; then
-            dnl Really add $additional_includedir to $CPPFLAGS.
-            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
-          fi
-        fi
-      fi
-    fi
-    dnl Potentially add $additional_libdir to $LDFLAGS.
-    dnl But don't add it
-    dnl   1. if it's the standard /usr/lib,
-    dnl   2. if it's already present in $LDFLAGS,
-    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
-    dnl   4. if it doesn't exist as a directory.
-    if test "X$additional_libdir" != "X/usr/lib"; then
-      haveit=
-      for x in $LDFLAGS; do
-        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
-        if test "X$x" = "X-L$additional_libdir"; then
-          haveit=yes
-          break
-        fi
-      done
-      if test -z "$haveit"; then
-        if test "X$additional_libdir" = "X/usr/local/lib"; then
-          if test -n "$GCC"; then
-            case $host_os in
-              linux*) haveit=yes;;
-            esac
-          fi
-        fi
-        if test -z "$haveit"; then
-          if test -d "$additional_libdir"; then
-            dnl Really add $additional_libdir to $LDFLAGS.
-            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
-          fi
-        fi
-      fi
-    fi
-  fi
-])
-
-dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
-dnl acl_final_exec_prefix, containing the values to which $prefix and
-dnl $exec_prefix will expand at the end of the configure script.
-AC_DEFUN([AC_LIB_PREPARE_PREFIX],
-[
-  dnl Unfortunately, prefix and exec_prefix get only finally determined
-  dnl at the end of configure.
-  if test "X$prefix" = "XNONE"; then
-    acl_final_prefix="$ac_default_prefix"
-  else
-    acl_final_prefix="$prefix"
-  fi
-  if test "X$exec_prefix" = "XNONE"; then
-    acl_final_exec_prefix='${prefix}'
-  else
-    acl_final_exec_prefix="$exec_prefix"
-  fi
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
-  prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
-dnl variables prefix and exec_prefix bound to the values they will have
-dnl at the end of the configure script.
-AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
-[
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  $1
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-])
diff --git a/config/mh-x86omitfp b/config/mh-x86omitfp
deleted file mode 100644
index 563f02b..0000000
--- a/config/mh-x86omitfp
+++ /dev/null
@@ -1,2 +0,0 @@
-# Add -fomit-frame-pointer to the usual BOOT_CFLAGS to speed up the compiler.
-BOOT_CFLAGS = -O2 -g -fomit-frame-pointer
diff --git a/config/nls.m4 b/config/nls.m4
deleted file mode 100644
index 36bc493..0000000
--- a/config/nls.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# nls.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-
-AC_DEFUN([AM_NLS],
-[
-  AC_MSG_CHECKING([whether NLS is requested])
-  dnl Default is enabled NLS
-  AC_ARG_ENABLE(nls,
-    [  --disable-nls           do not use Native Language Support],
-    USE_NLS=$enableval, USE_NLS=yes)
-  AC_MSG_RESULT($USE_NLS)
-  AC_SUBST(USE_NLS)
-])
-
-AC_DEFUN([AM_MKINSTALLDIRS],
-[
-  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
-  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
-  dnl Try to locate it.
-  MKINSTALLDIRS=
-  if test -n "$ac_aux_dir"; then
-    case "$ac_aux_dir" in
-      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
-      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
-    esac
-  fi
-  if test -z "$MKINSTALLDIRS"; then
-    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
-  fi
-  AC_SUBST(MKINSTALLDIRS)
-])
diff --git a/config/po.m4 b/config/po.m4
deleted file mode 100644
index 861e3de..0000000
--- a/config/po.m4
+++ /dev/null
@@ -1,197 +0,0 @@
-# po.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-
-dnl Checks for all prerequisites of the po subdirectory.
-AC_DEFUN([AM_PO_SUBDIRS],
-[
-  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-  AC_REQUIRE([AC_PROG_INSTALL])dnl
-  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
-  AC_REQUIRE([AM_NLS])dnl
-
-  dnl Perform the following tests also if --disable-nls has been given,
-  dnl because they are needed for "make dist" to work.
-
-  dnl Search for GNU msgfmt in the PATH.
-  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
-  dnl The second test excludes FreeBSD msgfmt.
-  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
-    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
-     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
-    :)
-  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
-
-  dnl Search for GNU xgettext 0.12 or newer in the PATH.
-  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
-  dnl The second test excludes FreeBSD xgettext.
-  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
-    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
-     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
-    :)
-  dnl Remove leftover from FreeBSD xgettext call.
-  rm -f messages.po
-
-  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
-  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
-    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
-
-  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
-  dnl Test whether we really found GNU msgfmt.
-  if test "$GMSGFMT" != ":"; then
-    dnl If it is no GNU msgfmt we define it as : so that the
-    dnl Makefiles still can work.
-    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
-       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
-      : ;
-    else
-      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
-      AC_MSG_RESULT(
-        [found $GMSGFMT program is not GNU msgfmt; ignore it])
-      GMSGFMT=":"
-    fi
-  fi
-
-  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
-  dnl Test whether we really found GNU xgettext.
-  if test "$XGETTEXT" != ":"; then
-    dnl If it is no GNU xgettext we define it as : so that the
-    dnl Makefiles still can work.
-    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
-       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
-      : ;
-    else
-      AC_MSG_RESULT(
-        [found xgettext program is not GNU xgettext; ignore it])
-      XGETTEXT=":"
-    fi
-    dnl Remove leftover from FreeBSD xgettext call.
-    rm -f messages.po
-  fi
-
-  AC_OUTPUT_COMMANDS([
-    for ac_file in $CONFIG_FILES; do
-      # Support "outfile[:infile[:infile...]]"
-      case "$ac_file" in
-        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-      esac
-      # PO directories have a Makefile.in generated from Makefile.in.in.
-      case "$ac_file" in */Makefile.in)
-        # Adjust a relative srcdir.
-        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
-        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
-        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
-        # In autoconf-2.13 it is called $ac_given_srcdir.
-        # In autoconf-2.50 it is called $srcdir.
-        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
-        case "$ac_given_srcdir" in
-          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
-          /*) top_srcdir="$ac_given_srcdir" ;;
-          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
-        esac
-        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
-          rm -f "$ac_dir/POTFILES"
-          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
-          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
-          POMAKEFILEDEPS="POTFILES.in"
-          # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
-          # on $ac_dir but don't depend on user-specified configuration
-          # parameters.
-          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
-            # The LINGUAS file contains the set of available languages.
-            if test -n "$OBSOLETE_ALL_LINGUAS"; then
-              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
-            fi
-            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
-            # Hide the ALL_LINGUAS assigment from automake.
-            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
-            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
-          else
-            # The set of available languages was given in configure.in.
-            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
-          fi
-          case "$ac_given_srcdir" in
-            .) srcdirpre= ;;
-            *) srcdirpre='$(srcdir)/' ;;
-          esac
-          POFILES=
-          GMOFILES=
-          UPDATEPOFILES=
-          DUMMYPOFILES=
-          for lang in $ALL_LINGUAS; do
-            POFILES="$POFILES $srcdirpre$lang.po"
-            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
-            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
-            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
-          done
-          # CATALOGS depends on both $ac_dir and the user's LINGUAS
-          # environment variable.
-          INST_LINGUAS=
-          if test -n "$ALL_LINGUAS"; then
-            for presentlang in $ALL_LINGUAS; do
-              useit=no
-              if test "%UNSET%" != "$LINGUAS"; then
-                desiredlanguages="$LINGUAS"
-              else
-                desiredlanguages="$ALL_LINGUAS"
-              fi
-              for desiredlang in $desiredlanguages; do
-                # Use the presentlang catalog if desiredlang is
-                #   a. equal to presentlang, or
-                #   b. a variant of presentlang (because in this case,
-                #      presentlang can be used as a fallback for messages
-                #      which are not translated in the desiredlang catalog).
-                case "$desiredlang" in
-                  "$presentlang"*) useit=yes;;
-                esac
-              done
-              if test $useit = yes; then
-                INST_LINGUAS="$INST_LINGUAS $presentlang"
-              fi
-            done
-          fi
-          CATALOGS=
-          if test -n "$INST_LINGUAS"; then
-            for lang in $INST_LINGUAS; do
-              CATALOGS="$CATALOGS $lang.gmo"
-            done
-          fi
-          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
-          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
-          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
-            if test -f "$f"; then
-              case "$f" in
-                *.orig | *.bak | *~) ;;
-                *) cat "$f" >> "$ac_dir/Makefile" ;;
-              esac
-            fi
-          done
-        fi
-        ;;
-      esac
-    done],
-   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
-    # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
-    # from automake.
-    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
-    # Capture the value of LINGUAS because we need it to compute CATALOGS.
-    LINGUAS="${LINGUAS-%UNSET%}"
-   ])
-])
diff --git a/config/stdint_h.m4 b/config/stdint_h.m4
deleted file mode 100644
index 32ba7ae..0000000
--- a/config/stdint_h.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-# stdint_h.m4 serial 3 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([jm_AC_HEADER_STDINT_H],
-[
-  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
-  [AC_TRY_COMPILE(
-    [#include <sys/types.h>
-#include <stdint.h>],
-    [uintmax_t i = (uintmax_t) -1;],
-    jm_ac_cv_header_stdint_h=yes,
-    jm_ac_cv_header_stdint_h=no)])
-  if test $jm_ac_cv_header_stdint_h = yes; then
-    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
-      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
-       and declares uintmax_t. ])
-  fi
-])
diff --git a/config/uintmax_t.m4 b/config/uintmax_t.m4
deleted file mode 100644
index b5f28d4..0000000
--- a/config/uintmax_t.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# uintmax_t.m4 serial 7 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-AC_PREREQ(2.13)
-
-# Define uintmax_t to 'unsigned long' or 'unsigned long long'
-# if it is not already defined in <stdint.h> or <inttypes.h>.
-
-AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
-[
-  AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
-  AC_REQUIRE([jm_AC_HEADER_STDINT_H])
-  if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
-    AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
-    test $ac_cv_type_unsigned_long_long = yes \
-      && ac_type='unsigned long long' \
-      || ac_type='unsigned long'
-    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
-      [Define to unsigned long or unsigned long long
-       if <stdint.h> and <inttypes.h> don't define.])
-  else
-    AC_DEFINE(HAVE_UINTMAX_T, 1,
-      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
-  fi
-])
diff --git a/config/ulonglong.m4 b/config/ulonglong.m4
deleted file mode 100644
index c375e47..0000000
--- a/config/ulonglong.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
-dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
-[
-  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
-  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
-    [unsigned long long ullmax = (unsigned long long) -1;
-     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
-    ac_cv_type_unsigned_long_long=yes,
-    ac_cv_type_unsigned_long_long=no)])
-  if test $ac_cv_type_unsigned_long_long = yes; then
-    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
-      [Define if you have the unsigned long long type.])
-  fi
-])
diff --git a/config/warnings.m4 b/config/warnings.m4
deleted file mode 100644
index 5501be9..0000000
--- a/config/warnings.m4
+++ /dev/null
@@ -1,97 +0,0 @@
-# Autoconf include file defining macros related to compile-time warnings.
-
-# Copyright 2004 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#GCC is free software; you can redistribute it and/or modify it under
-#the terms of the GNU General Public License as published by the Free
-#Software Foundation; either version 2, or (at your option) any later
-#version.
-
-#GCC is distributed in the hope that it will be useful, but WITHOUT
-#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GCC; see the file COPYING.  If not, write to the Free
-#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-#02111-1307, USA.
-
-# ACX_PROG_CC_WARNING_OPTS([-Wfoo -Wbar -Wbaz])
-#   Sets @WARN_CFLAGS@ to the subset of the given options which the
-#   compiler accepts.
-AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_SUBST([WARN_CFLAGS])dnl
-WARN_CFLAGS=
-save_CFLAGS="$CFLAGS"
-for option in $1; do
-  AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
-  AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
-    [CFLAGS="$option"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_VAR_SET(acx_Woption, yes)],
-      [AS_VAR_SET(acx_Woption, no)])
-  ])
-  AS_IF([test AS_VAR_GET(acx_Woption) = yes],
-        [WARN_CFLAGS="$WARN_CFLAGS${WARN_CFLAGS:+ }$option"])
-  AS_VAR_POPDEF([acx_Woption])dnl
-done
-CFLAGS="$save_CFLAGS"
-])# ACX_PROG_CC_WARNING_OPTS
-
-# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long ...])
-#   Sets WARN_PEDANTIC to "-pedantic" + the argument, if the compiler
-#   accepts all of those options simultaneously, otherwise to nothing.
-AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_SUBST([WARN_PEDANTIC])dnl
-AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_$1])dnl
-WARN_PEDANTIC=
-AC_CACHE_CHECK([whether $CC supports -pedantic $1], acx_Pedantic,
-[save_CFLAGS="$CFLAGS"
-CFLAGS="-pedantic $1"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
-   [AS_VAR_SET(acx_Pedantic, yes)],
-   [AS_VAR_SET(acx_Pedantic, no)])
-CFLAGS="$save_CFLAGS"])
-AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
-      [WARN_PEDANTIC="-pedantic $1"])
-AS_VAR_POPDEF([acx_Pedantic])dnl
-])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
-
-# ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z])
-#   sets WERROR to "-Werror" if the compiler is GCC >=x.y.z, or if
-#   --enable-werror-always was given on the command line, otherwise
-#   to nothing.
-#   If the argument is the word "manual" instead of a version number,
-#   then WERROR will be set to -Werror only if --enable-werror-always
-#   appeared on the configure command line.
-AC_DEFUN([ACX_PROG_CC_WARNINGS_ARE_ERRORS],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_SUBST([WERROR])dnl
-WERROR=
-AC_ARG_ENABLE(werror-always, 
-    AS_HELP_STRING([--enable-werror-always],
-		   [enable -Werror despite compiler version]),
-[], [enable_werror_always=no])
-AS_IF([test $enable_werror_always = yes],
-      [WERROR=-Werror],
- m4_if($1, [manual],,
- [AS_VAR_PUSHDEF([acx_GCCvers], [acx_cv_prog_cc_gcc_$1_or_newer])dnl
-  AC_CACHE_CHECK([whether $CC is GCC >=$1], acx_GCCvers,
-    [set fnord `echo $1 | tr '.' ' '`
-     shift
-     AC_PREPROC_IFELSE(
-[#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
-  < [$]1 * 10000 + [$]2 * 100 + [$]3
-#error insufficient
-#endif],
-   [AS_VAR_SET(acx_GCCvers, yes)],
-   [AS_VAR_SET(acx_GCCvers, no)])])
- AS_IF([test AS_VAR_GET(acx_GCCvers) = yes],
-       [WERROR=-WerrorB])
-  AS_VAR_POPDEF([acx_GCCvers])]))
-])# ACX_PROG_CC_WARNINGS_ARE_ERRORS
diff --git a/configure b/configure
index 1d5e393..35c07a2 100755
--- a/configure
+++ b/configure
@@ -1024,8 +1024,8 @@
 
 # If both --with-headers and --with-libs are specified, default to
 # --without-newlib.
-if test x"${with_headers}" != x && test x"${with_headers}" != xno \
-   && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
+if test x"${with_headers}" != x && test x"${with_headers} != xno \
+   && test x"${with_libs}" != x && test x"${with_libs} != xno ; then
   if test x"${with_newlib}" = x ; then
     with_newlib=no
   fi
@@ -1141,10 +1141,11 @@
     ;;
   powerpc-*-darwin*)
     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
+    noconfigdirs="$noconfigdirs target-libobjc"
     ;;
   *-*-darwin*)
     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
-    noconfigdirs="$noconfigdirs ${libgcj}"
+    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
     ;;
   *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
@@ -1281,7 +1282,7 @@
     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
     ;;
   crx-*-*)
-    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
+    noconfigdirs="$noconfigdirs target-libgloss target-libstdc++-v3 target-mudflap ${libgcj}"
     ;;
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
@@ -1368,9 +1369,10 @@
     target_configdirs="$target_configdirs target-libtermcap target-winsup"
     noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
     # always build newlib if winsup directory is present.
-    if test -d "$srcdir/winsup"; then
+    if test -d "$srcdir/winsup"
+    then
       skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
-    elif test -d "$srcdir/newlib"; then
+    else
       echo "Warning: winsup is missing so newlib can't be built."
     fi
 
@@ -1714,11 +1716,6 @@
   *-*-sysv4*)
     host_makefile_frag="config/mh-sysv4"
     ;;
-  # This is placed last to prevent interfering with the cases above.
-  i[3456789]86-*-*)
-    # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
-    host_makefile_frag="config/mh-x86omitfp"
-    ;;
 esac
 fi
 
@@ -1774,7 +1771,7 @@
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1778: checking for $ac_word" >&5
+echo "configure:1775: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1804,7 +1801,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1808: checking for $ac_word" >&5
+echo "configure:1805: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1855,7 +1852,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1859: checking for $ac_word" >&5
+echo "configure:1856: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1887,7 +1884,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1891: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1898,12 +1895,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1902 "configure"
+#line 1899 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1929,12 +1926,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1933: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1930: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1938: checking whether we are using GNU C" >&5
+echo "configure:1935: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1943,7 +1940,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1962,7 +1959,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1966: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1963: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2029,7 +2026,7 @@
 # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2033: checking for $ac_word" >&5
+echo "configure:2030: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2061,7 +2058,7 @@
   # Extract the first word of "gnatbind", so it can be a program name with args.
 set dummy gnatbind; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2065: checking for $ac_word" >&5
+echo "configure:2062: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2094,7 +2091,7 @@
 fi
 
 echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6
-echo "configure:2098: checking whether compiler driver understands Ada" >&5
+echo "configure:2095: checking whether compiler driver understands Ada" >&5
 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2127,7 +2124,7 @@
 fi
 
 echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6
-echo "configure:2131: checking how to compare bootstrapped objects" >&5
+echo "configure:2128: checking how to compare bootstrapped objects" >&5
 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2225,9 +2222,9 @@
 CFLAGS="$CFLAGS $gmpinc"
 # Check GMP actually works
 echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6
-echo "configure:2229: checking for correct version of gmp.h" >&5
+echo "configure:2226: checking for correct version of gmp.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2231 "configure"
+#line 2228 "configure"
 #include "confdefs.h"
 #include "gmp.h"
 int main() {
@@ -2238,7 +2235,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -2251,12 +2248,12 @@
 
 if test x"$have_gmp" = xyes; then
   echo $ac_n "checking for MPFR""... $ac_c" 1>&6
-echo "configure:2255: checking for MPFR" >&5
+echo "configure:2252: checking for MPFR" >&5
 
   saved_LIBS="$LIBS"
   LIBS="$LIBS $gmplibs"
   cat > conftest.$ac_ext <<EOF
-#line 2260 "configure"
+#line 2257 "configure"
 #include "confdefs.h"
 #include <gmp.h>
 #include <mpfr.h>
@@ -2264,7 +2261,7 @@
 mpfr_t n; mpfr_init(n);
 ; return 0; }
 EOF
-if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -2741,7 +2738,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2745: checking for $ac_word" >&5
+echo "configure:2742: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_BISON'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2776,7 +2773,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2780: checking for $ac_word" >&5
+echo "configure:2777: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2811,7 +2808,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2815: checking for $ac_word" >&5
+echo "configure:2812: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_M4'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2846,7 +2843,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2850: checking for $ac_word" >&5
+echo "configure:2847: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_FLEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2881,7 +2878,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2885: checking for $ac_word" >&5
+echo "configure:2882: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2916,7 +2913,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2920: checking for $ac_word" >&5
+echo "configure:2917: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_MAKEINFO'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3550,7 +3547,7 @@
   # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3554: checking for $ac_word" >&5
+echo "configure:3551: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3583,7 +3580,7 @@
     # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3587: checking for $ac_word" >&5
+echo "configure:3584: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3622,7 +3619,7 @@
   # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3626: checking for $ac_word" >&5
+echo "configure:3623: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3655,7 +3652,7 @@
     # Extract the first word of "as", so it can be a program name with args.
 set dummy as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3659: checking for $ac_word" >&5
+echo "configure:3656: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3694,7 +3691,7 @@
   # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3698: checking for $ac_word" >&5
+echo "configure:3695: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3727,7 +3724,7 @@
     # Extract the first word of "dlltool", so it can be a program name with args.
 set dummy dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3731: checking for $ac_word" >&5
+echo "configure:3728: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3766,7 +3763,7 @@
   # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3770: checking for $ac_word" >&5
+echo "configure:3767: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3799,7 +3796,7 @@
     # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3803: checking for $ac_word" >&5
+echo "configure:3800: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3838,7 +3835,7 @@
   # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3842: checking for $ac_word" >&5
+echo "configure:3839: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3871,7 +3868,7 @@
     # Extract the first word of "nm", so it can be a program name with args.
 set dummy nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3875: checking for $ac_word" >&5
+echo "configure:3872: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3910,7 +3907,7 @@
   # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3914: checking for $ac_word" >&5
+echo "configure:3911: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3943,7 +3940,7 @@
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3947: checking for $ac_word" >&5
+echo "configure:3944: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3982,7 +3979,7 @@
   # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3986: checking for $ac_word" >&5
+echo "configure:3983: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4015,7 +4012,7 @@
     # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4019: checking for $ac_word" >&5
+echo "configure:4016: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4054,7 +4051,7 @@
   # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}objcopy; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4058: checking for $ac_word" >&5
+echo "configure:4055: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4087,7 +4084,7 @@
     # Extract the first word of "objcopy", so it can be a program name with args.
 set dummy objcopy; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4091: checking for $ac_word" >&5
+echo "configure:4088: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4126,7 +4123,7 @@
   # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}objdump; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4130: checking for $ac_word" >&5
+echo "configure:4127: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4159,7 +4156,7 @@
     # Extract the first word of "objdump", so it can be a program name with args.
 set dummy objdump; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4163: checking for $ac_word" >&5
+echo "configure:4160: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4205,7 +4202,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4209: checking for $ac_word" >&5
+echo "configure:4206: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4238,7 +4235,7 @@
     # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4242: checking for $ac_word" >&5
+echo "configure:4239: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4277,7 +4274,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4281: checking for $ac_word" >&5
+echo "configure:4278: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4310,7 +4307,7 @@
     # Extract the first word of "as", so it can be a program name with args.
 set dummy as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4314: checking for $ac_word" >&5
+echo "configure:4311: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4349,7 +4346,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4353: checking for $ac_word" >&5
+echo "configure:4350: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4382,7 +4379,7 @@
     # Extract the first word of "dlltool", so it can be a program name with args.
 set dummy dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4386: checking for $ac_word" >&5
+echo "configure:4383: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4421,7 +4418,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4425: checking for $ac_word" >&5
+echo "configure:4422: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4454,7 +4451,7 @@
     # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4458: checking for $ac_word" >&5
+echo "configure:4455: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4493,7 +4490,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4497: checking for $ac_word" >&5
+echo "configure:4494: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4526,7 +4523,7 @@
     # Extract the first word of "nm", so it can be a program name with args.
 set dummy nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4530: checking for $ac_word" >&5
+echo "configure:4527: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4565,7 +4562,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4569: checking for $ac_word" >&5
+echo "configure:4566: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4598,7 +4595,7 @@
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4602: checking for $ac_word" >&5
+echo "configure:4599: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4637,7 +4634,7 @@
   # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4641: checking for $ac_word" >&5
+echo "configure:4638: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4670,7 +4667,7 @@
     # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4674: checking for $ac_word" >&5
+echo "configure:4671: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4755,7 +4752,7 @@
 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4759: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:4756: checking whether to enable maintainer-specific portions of Makefiles" >&5
 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -4802,7 +4799,7 @@
 # gcc for stageN-gcc and stagePREV-gcc for stage(N-1).  In case this is not
 # possible, however, we can resort to mv.
 echo $ac_n "checking if symbolic links between directories work""... $ac_c" 1>&6
-echo "configure:4806: checking if symbolic links between directories work" >&5
+echo "configure:4803: checking if symbolic links between directories work" >&5
 if eval "test \"`echo '$''{'gcc_cv_prog_ln_s_dir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4850,26 +4847,6 @@
 esac
 
 
-# If gcc is built natively with shared library enabled, set
-# $RPATH_ENVVAR to make sure the newly built gcc shared librares are
-# used.
-SET_GCC_LIB_PATH=
-if test -d ${srcdir}/gcc && test x${is_cross_compiler} = xno; then
-  case "${enable_shared}" in
-    no | "") ;;
-    *)
-      eval "d=\$$RPATH_ENVVAR"
-      if test x"$d" != x; then
-	d="$pwd/gcc:$d"
-      else
-	d="$pwd/gcc"
-    fi
-    SET_GCC_LIB_PATH="\$(RPATH_ENVVAR)=$d; export \$(RPATH_ENVVAR);"
-    ;;
-  esac
-fi
-
-
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -4936,15 +4913,34 @@
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
 
 
 # Without the "./", some shells look in PATH for config.status.
@@ -5139,7 +5135,6 @@
 s%@CREATE_LINK_TO_DIR@%$CREATE_LINK_TO_DIR%g
 s%@UNDO_LINK_TO_DIR@%$UNDO_LINK_TO_DIR%g
 s%@stage2_werror_flag@%$stage2_werror_flag%g
-s%@SET_GCC_LIB_PATH@%$SET_GCC_LIB_PATH%g
 
 CEOF
 EOF
diff --git a/configure.in b/configure.in
index 0ac4304..9c32e12 100644
--- a/configure.in
+++ b/configure.in
@@ -250,8 +250,8 @@
 
 # If both --with-headers and --with-libs are specified, default to
 # --without-newlib.
-if test x"${with_headers}" != x && test x"${with_headers}" != xno \
-   && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
+if test x"${with_headers}" != x && test x"${with_headers} != xno \
+   && test x"${with_libs}" != x && test x"${with_libs} != xno ; then
   if test x"${with_newlib}" = x ; then
     with_newlib=no
   fi
@@ -363,10 +363,11 @@
     ;;
   powerpc-*-darwin*)
     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
+    noconfigdirs="$noconfigdirs target-libobjc"
     ;;
   *-*-darwin*)
     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
-    noconfigdirs="$noconfigdirs ${libgcj}"
+    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
     ;;
   *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
@@ -503,7 +504,7 @@
     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
     ;;
   crx-*-*)
-    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
+    noconfigdirs="$noconfigdirs target-libgloss target-libstdc++-v3 target-mudflap ${libgcj}"
     ;;
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
@@ -590,9 +591,10 @@
     target_configdirs="$target_configdirs target-libtermcap target-winsup"
     noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
     # always build newlib if winsup directory is present.
-    if test -d "$srcdir/winsup"; then
+    if test -d "$srcdir/winsup"
+    then
       skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
-    elif test -d "$srcdir/newlib"; then
+    else
       echo "Warning: winsup is missing so newlib can't be built."
     fi
 
@@ -936,11 +938,6 @@
   *-*-sysv4*)
     host_makefile_frag="config/mh-sysv4"
     ;;
-  # This is placed last to prevent interfering with the cases above.
-  i[[3456789]]86-*-*)
-    # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
-    host_makefile_frag="config/mh-x86omitfp"
-    ;;
 esac
 fi
 
@@ -2296,24 +2293,4 @@
 esac
 AC_SUBST(stage2_werror_flag)
 
-# If gcc is built natively with shared library enabled, set
-# $RPATH_ENVVAR to make sure the newly built gcc shared librares are
-# used.
-SET_GCC_LIB_PATH=
-if test -d ${srcdir}/gcc && test x${is_cross_compiler} = xno; then
-  case "${enable_shared}" in
-    no | "") ;;
-    *)
-      eval "d=\$$RPATH_ENVVAR"
-      if test x"$d" != x; then
-	d="$pwd/gcc:$d"
-      else
-	d="$pwd/gcc"
-    fi
-    SET_GCC_LIB_PATH="\$(RPATH_ENVVAR)=$d; export \$(RPATH_ENVVAR);"
-    ;;
-  esac
-fi
-AC_SUBST(SET_GCC_LIB_PATH)
-
 AC_OUTPUT(Makefile)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ddba9e..90d02c5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,1011 +1,3 @@
-2004-10-15  Joel Brobecker  <brobecker@gnat.com>
-
-	* dwarf2read.c (set_cu_language): Set language to Ada for
-	DW_LANG_Ada83 and DW_LANG_Ada95.
-
-2004-10-15  Michael Chastain  <mec.gnu@mindspring.com>
-
-	From Andreas Schwab <schwab@suse.de>:
-	* Makefile.in (.y.c, .l.c.): Fix the substitutions for
-	for xmalloc and xrealloc.
-
-2004-10-15  Andrew Cagney  <cagney@gnu.org>
-
-	* ada-exp.y, ada-lex.l: Use xmalloc and xrealloc through out.
-	* inf-ptrace.c: Include "gdb_wait.h" instead of <wait.h>.
-	* Makefile.in (.y.c, .l.c): Don't replace xmalloc with xxmalloc.
-	Update dependencies.
-
-2004-10-15  Paul Hilfinger  <Hilfinger@gnat.com>
-
-	* ada-lang.c (ada_lookup_symbol): Correct comment.
-	(ada_evaluate_subexp): Change error message for
-	OP_FUNCALL case so as not to indicate an internal error.
-	
-2004-10-15  Joel Brobecker  <brobecker@gnat.com>
-
-	Committed by Paul Hilfinger.
-	* ada-lang.c (ada_template_to_fixed_record_type_1): Detect bogus
-	type sizes in XVE/XVU types, and emit a warning when that happens,
-	instead of rounding up the size of the resulting type.
-	Some minor reformatting.
-	(ada_is_aligner_type): Do not consider a type as an aligner type 
-	if there is a corresponding XVS type as well.
-	(ada_evaluate_subexp): For TERNOP_SLICE, handle cases where we 
-	have several levels of pointer indirection to the array.
-	
-2004-10-15  Jerome Guitton  <guitton@gnat.com>
-
-	Committed by Paul Hilfinger.
-	* ada-lang.c (check_size): New function.
-	(coerce_unspec_val_to_type): call check_size to make sure
-	that the object size is reasonable.
-	(ada_evaluate_subexp): in UNOP_IND: Ditto. In TERNOP_SLICE:
-	Implements the case when we get a reference when we evaluate
-	the expression of one of the bounds of the slice.
-	(ada_value_struct_elt): when a packed array field is
-	a reference, use ada_coerce_ref to dereference it; use 
-	ada_value_ind only if it is a pointer.
-
-2004-10-15  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips32_scan_prologue): Move the implementation up
-	a bit to avoid the necessity of an advance declaration. Remove
-	declaration.
-	(set_reg_offset): Move implemenation up.
-	(mips16_get_imm): Likewise.
-	(mips16_scan_prologue): Likewise.
-	(reset_saved_regs): Likewise.
-	(mips32_scan_prologue): Likewise.
-
-2004-10-14  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips32_scan_prologue): Add advance declaration.
-	Remove sp as a parameter, compute it internally instead. Move
-	prologue scanning limit from heuristic_proc_desc to here.
-	(mips16_scan_prologue): Likewise.
-	(mips_insn16_frame_cache): Replace call to heuristic_proc_desc
-	by call to mips16_scan_prologue.
-	(mips_insn32_frame_cache): Replace call to heuristic_proc_desc
-	by call to mips32_scan_prologue.
-	(heuristic_proc_desc): Remove code that's no longer necessary.
-	Update calls to mips16_scan_prologue and mips32_scan_prologue.
-	(mips_skip_prologue): Update calls to mips16_scan_prologue
-	and mips32_scan_prologue.
-
-2004-10-14  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips16_scan_prologue): Merge code from
-	mips16_skip_prologue.  Now return the address of the first
-	instruction past the function prologue.
-	(mips16_skip_prologue): Remove, no longer necessary.
-	(mips_skip_prologue): Replace call to mips16_skip_prologue
-	by call to mips16_scan_prologue.
-
-2004-10-14  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips32_scan_prologue): Merge code from
-	mips32_skip_prologue.  Now return the address of the first
-	instruction past the function prologue.
-	(mips32_skip_prologue): Remove.  No longer necessary.
-	(mips16_skip_prologue): Add parameter end_pc instead of
-	computing it.
-	(mips_skip_prologue): Compute the upper limit for the
-	prologue scanning. Update call to mips16_skip_prologue.
-	Replace call to mips32_skip_prologue by call to
-	mips32_scan_prologue.
-
-2004-10-14  Mark Kettenis  <kettenis@gnu.org>
-
-	* hppa-tdep.c (hppa_frame_cache): Add support for OpenBSD and
-	NetBSD system call stubs that store %rp in the ERP slot of the
-	stack frame.
-
-	* source.c: Always define O_BINARY to 0 if not defined already.
-	(openp): Unconditionally use O_BINARY.
-
-	* top.c (gdb_readline): Always accept "\r\n" as a line-ending.
-	* event-top.c (gdb_readline2): Likewise.
-
-2004-10-14  Orjan Friberg  <orjanf@axis.com>
-
-	* cris-tdep.c (_initialize_cris_tdep): Re-add call to
-	deprecated_add_core_fns which was removed by mistake.
-
-2004-10-13  Kevin Buettner  <kevinb@redhat.com>
-
-	* ia64-linux-nat.c (fill_gregset, fill_fpregset): Replace
-	references to deprecated_registers[] with equivalent code.
-
-2004-10-13  Kevin Buettner  <kevinb@redhat.com>
-
-	* rs6000-tdep.c (rs6000_push_dummy_call): Replace references to
-	``deprecated_registers'' with equivalent code.  Use gdb_assert()
-	instead of explicit test and print statement.
-
-2004-10-12  Mark Kettenis  <kettenis@gnu.org>
-
-	* sparc-nat.c: Include "inf-ptrace.h".
-	(sparc_target): New function.
-	* sparc-nat.h: Update copyright year.
-	(sparc_target): New prototype.
-	* sparcnbsd-nat.c: Don't include "gdbcore.h", include "target.h".
-	(_initialize_sparcnbsd_nat): Construct and add target vector.
-	* sparc64nbsd-nat.c: Include "target.h".
-	(_initialize_sparc64nbsd_nat): Construct and add target vector.
-	* Makefile.in (sparc-nat.o, sparcnbsd-nat.o, sparc64nbsd-nat.o):
-	Update dependencies.
-	* config/sparc/nbsd64.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o, add inf-ptrace.o.
-	* config/sparc/nbsdaout.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o, add inf-ptrace.o and bsd-kvm.o.
-	(NAT_FILE): Set to nm-bsd.h.
-	(LOADLIBES): New variable.
-	* config/sparc/nbsdelf.mh (NATDEPFILES): Remove infptrace.o and
-	infarg.o, add inf-ptrace.o.
-	* config/sparc/nm-nbsdaout.h: Remove file.
-	* config/sparc/fbsd.mh (NATDEPFILES): Add inf-ptrace.o.
-	* config/sparc/linux.mh (NATDEPFILES): Add inf-ptrace.o.
-	* config/sparc/linux64.mh (NATDEPFILES): Add inf-ptrace.o.
-
-	* defs.h [!FOPEN_RB]: Include "fopen-bin.h" instead of
-	"fopen-same.h".  Update comment.
-
-2004-10-11  Mark Kettenis  <kettenis@gnu.org>
-
-	* i386gnu-nat.c: Include "gdb_string.h".
-	(fetch_fpregs): Use i387_supply_fxsave to fill the floating-point
-	registers when the floating-point state isn't initialized.
-	* Makefile.in (i386gnu-nat.o): Update dependencies.
-
-2004-10-11  David Anderson  <davea@sgi.com>
-
-	* regcache.c (regcache_raw_read): Comment was missing "to".
-	Extraneous ' removed.
-	* gdb_thread_db.h (struct td_thrinfo): ti_lid field
-	comment now describes use.
-
-2004-10-11  Orjan Friberg  <orjanf@axis.com>
-
-	* cris-tdep.c (cris_sigtramp_start, cris_rt_sigtramp_start)
-	(cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache)
-	(cris_sigtramp_frame_this_id, cris_sigtramp_frame_prev_register)
-	(cris_sigtramp_frame_sniffer): New functions.
-	(cris_gdbarch_init): Hook in signal trampoline unwinder.
-	(cris_dwarf2_reg_to_regnum, cris_dwarf2_frame_init_reg): New functions.
-	(cris_gdbarch_init): Hook in Dwarf-2 unwinder.
-	(struct gdbarch_tdep, set_cris_dwarf2_cfi, cris_dump_tdep)
-	(cris_gdbarch_init, _initialize_cris_tdep): Add CRIS Dwarf-2 CFI usage
-	command.
-	(cris_version_update): Remove, replace with ...
-	(set_cris_version): New function.
-	(struct gdbarch_tdep, cris_mode, cris_mode_update)
-	(cris_cannot_store_register, cris_dump_tdep, cris_gdbarch_init)
-	(_initialize_cris_tdep): Remove CRIS mode command.
-	(cris_fpless_backtrace, _initialize_cris_tdep): Remove 
-	cris-fpless-backtrace command.
-	(cris_scan_prologue): Fix prologue scanning limit.
-	(cris_register_type): Update to reflect actual registers.
-	(cris_register_bytes_ok) Remove.
-	(cris_gdbarch_init): Remove support for CRIS v8 and v9.
-	Remove set_gdbarch_deprecated_register_size,
-	set_gdbarch_deprecated_register_byte, set_gdbarch_register_bytes_ok.
-	
-2004-10-10  Andrew Cagney  <cagney@gnu.org>
-
-	* ada-lang.c (lim_warning): Add ATTR_FORMAT prototype and FIXME
-	comment.
-
-2004-10-10  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips16_scan_prologue): Remove redundant code.
-
-2004-10-10  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips16_scan_prologue): Renames
-	mips16_heuristic_proc_desc. Update comment.
-	(mips32_scan_prologue): Renames mips32_heuristic_proc_desc.
-	(heuristic_proc_desc): Update calls to the 2 functions above.
-
-2004-10-10  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips_insn16_frame_cache): Remove unused variables.
-	Update comments. Also immediately return empty cache when the start
-	address of our function could not be found.
-	(mips_insn32_frame_cache): Likewise.
-
-2004-10-10  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips16_decode_reg_save): Delete, no longer used.
-	(mips_insn16_frame_cache): Pass frame cache in call to
-	heuristic_proc_desc. Move some code to mips16_heuristic_proc_desc.
-	Remove code that became redundant as a consequence.
-	(mips32_heuristic_proc_desc): No longer compute a fake
-	procedure descriptor. Compute the full frame cache instead.
-	Some minor comment reformatting.
-
-2004-10-10  Jim Blandy  <jimb@redhat.com>
-
-	* MAINTAINERS (generic symtabs, dwarf readers, elf reader, stabs
-	reader, tracing bytecode stuff): Remove self.
-
-2004-10-10  Mark Kettenis  <kettenis@gnu.org>
-
-	* sparc64-linux-tdep.c: Update copyright year.  Don't include
-	"solib-svr4.h".
-	(sparc64_linux_svr4_fetch_link_map_offsets): Remove function.
-	(sparc64_linux_init_abi): Don't set solib_svr4_link_map_offsets.
-	* Makefile.in (sparc64-linux-tdep.o): Update dependencies.
-
-	* sparc-linux-tdep.c: Update copyright year.
-	(sparc_linux_sigtramp_start): Change first argument from CORE_ADDR
-	to struct frame_info *.  Use safe_frame_unwind_memory instead of
-	deprecated_read_memory_nobpt.
-	(sparc32_linux_sigtramp_start, sparc32_linux_rt_sigtramp_start):
-	Change argumen from CORE_ADDR to struct frame_info *.  Adjust for
-	changed signature of sparc_linux_sigtramp_start.
-	(sparc32_linux_pc_in_sigtramp): Remove function.
-	(sparc32_linux_sigtramp_p): New function.
-	(sparc32_linux_sigtramp_frame_sniffer): Use
-	sparc32_linux_sigtramp_p instead of sparc32_linux_pc_in_sigtramp.
-
-	* sparc-linux-tdep.c (sparc32_linux_svr4_fetch_link_map_offsets):
-	Remove function.
-	(sparc32_linux_init_abi): Don't set solib_svr4_link_map_offsets.
-
-	* ada-lang.c (lim_warning): Re-implement as a varargs function.
-	(decode_packed_array_type, value_subscript_packed)
-	(ada_evaluate_subexp, to_fixed_range_type): Remove redundant
-	argument in call to lim_warning.
-
-	* configure.in: Really disable the TUI if an enhanced curses
-	library isn't found.
-	* configure: Regenerate.
-
-2004-10-09  Mark Kettenis  <kettenis@gnu.org>
-
-	* config/i386/nbsdaout.mh (NAT_FILE): Set to solib.h.
-	* config/i386/nbsdelf.mh (NAT_FILE): Set to solib.h.
-	* config/i386/nm-nbsdaout.h: Remove file.
-	* config/i386/nm-fbsd.h (link_object, lo_name, lo_library)
-	(lo_unused, lo_major, lo_minor, lo_next, link_map, lm_addr)
-	(lm_name, lm_next, lm_lop, lm_lob, lm_rwt, lm_ld, lm_lpd)
-	(link_dynamic_2, ld_loaded, ld_need, ld_rules, ld_got, ld_plt)
-	(ld_rel, ld_hash, ld_stab, ld_stab_hash, ld_buckets, ld_symbols)
-	(ld_symb_size, ld_text, ld_plt_sz, rtc_symb, rtc_sp, rtc_next)
-	(ld_debug, ldd_version, ldd_in_debugger, ldd_sym_loaded)
-	(ldd_bp_addr, ldd_bp_inst, ldd_cp, link_dynamic, ld_version)
-	(ldd, ld_un, ld_2): Remove defines.
-	* config/i386/nm-obsd.h: Likewise.
-
-2004-10-09  Paul Hilfinger  <hilfingr@nile.gnat.com>
-
-	* ada-lex.l: Remove useless rule whose right-context clause
-	causes unreferenced static function warning for yyrealloc.
-	(ada_flex_use): Remove the artificial reference to yyrealloc.
-
-2004-10-08  Andrew Cagney  <cagney@gnu.org>
-
-	* target.h (struct target_ops): Rename to_xfer_memory to
-	deprecated_xfer_memory.
-	* target.c: Update.
-	(deprecated_debug_xfer_memory): Rename debug_to_xfer_memory.
-	* wince.c: Update.
-	* win32-nat.c: Update.
-	* v850ice.c: Update.
-	* uw-thread.c: Update.
-	* thread-db.c: Update.
-	* sol-thread.c: Update.
-	* remote.c: Update.
-	* remote-vx.c: Update.
-	* remote-st.c: Update.
-	* remote-sim.c: Update.
-	* remote-sds.c: Update.
-	* remote-rdp.c: Update.
-	* remote-rdi.c: Update.
-	* remote-mips.c: Update.
-	* remote-m32r-sdi.c: Update.
-	* remote-e7000.c: Update.
-	* procfs.c: Update.
-	* ppc-bdm.c: Update.
-	* nto-procfs.c: Update.
-	* monitor.c: Update.
-	* linux-nat.c: Update.
-	* inftarg.c: Update.
-	* hpux-thread.c: Update.
-	* go32-nat.c: Update.
-	* gnu-nat.c: Update.
-	* exec.c: Update.
-	* corelow.c: Update.
-	* bsd-kvm.c: Update.
-	* aix-thread.c: Update.
-
-2004-10-08  Andrew Cagney  <cagney@gnu.org>
-
-	* target.c (debug_target): Move to near start of file.
-	(target_stopped_data_address_p): Re-org logic, add casts.
-
-2004-10-02  Mark Kettenis  <kettenis@gnu.org>
-
-	* solib-sunos.c [HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS] (link_map)
-	(lm_addr, lm_name, lm_next, link_dynamic_2, ld_loaded, rtc_symb)
-	(rtc_sp, rtc_next, ld_debug, ldd_in_debugger, ldd_bp_addr)
-	(ldd_bp_inst, ldd_cp, link_dynamic, ld_version, ldd, ld_un, ld_2):
-	New defines.
-
-2004-10-08  Jeff Johnston  <jjohnstn@redhat.com>
-
-	* target.h (to_stopped_data_address): Change prototype to
-	take a CORE_ADDR pointer and return an int.
-	* target.c (update_current_target): Change to_stopped_data_address
-	to match new prototype.
-	(debug_to_stopped_data_address): Change appropriately.
-	* breakpoint.c (bpstat_stop_status): Change call to
-	target_stopped_data_address to use new prototype.
-	* frv-tdep.c (frv_have_stopped_data_address): New function.
-	(frv_stopped_data_address): Change to new prototype and
-	functionality.
-	* ia64-linux-nat.c (ia64_stopped_data_address): Change to new
-	prototype and functionality.
-	(ia64_stopped_by_watchpoint): New function.
-	* i386-nat.c (i386_stopped_data_address): Change to new
-	prototype and functionality.
-	(i386_stopped_by_watchpoint): New function.
-	* remote.c (remote_stopped_data_address): Change to new prototype
-	and functionality.
-	* remote-m32r-sdi.c (m32r_stopped_data_address): Ditto.
-	* config/frv/tm-frv.h (frv_stopped_data_address): Change prototype.
-	(STOPPED_BY_WATCHPOINT): Change to use frv_have_stopped_data_address.
-	* config/i386/nm-i386.h (STOPPED_BY_WATCHPOINT): Change to use
-	new i386_stopped_by_watchpoint function.
-	(i386_stopped_by_watchpoint): New prototype.
-	(i386_stoppped_data_address): Change to new prototype.
-	* config/ia64/nm-linux.h (STOPPED_BY_WATCHPOINT): Change to use
-	new ia64_stopped_by_watchpoint function.
-	(ia64_stopped_by_watchpoint): New prototype.
-	(ia64_stopped_data_address): Ditto.
-
-2004-10-08  Paul Hilfinger  <Hilfinger@gnat.com>
-
-	* ada-typeprint.c (ada_print_type): Use int_string for printing
-	modulus of modular type.
-	* ada-lang.h (ada_modulus): Change return type to unsigned.
-	* ada-lang.c (ada_language_arch_info): Correct type of 
-	string_char_type.
-	(ada_modulus): Return unsigned result.
-	(ada_lookup_symbol): Remove user disambiguation and modify comment 
-	accordingly.
-	
-2004-10-08 Eric Botcazou  <ebotcazou@act-europe.fr>	
-
-	Committed by Paul Hilfinger.
-	* ada-lang.c (decode_packed_array): On big-endian targets, 
-	left-justify the value if it comes with a modular type.
-
-2004-10-08  Joel Brobecker  <brobecker@gnat.com>	
-
-	Committed by Paul Hilfinger.
-        * ada-lang.c (template_to_static_fixed_type): Fix a small typo.
-	(is_name_suffix): Add support for "___JM" suffixes.
-	(ada_check_typedef): Renames ada_completed_type. 
-	Update all users of CHECK_TYPEDEF, check_typedef, and 
-	ada_complete_type to call ada_check_typedef.
-	* ada-typeprint.c: Likewise.
-	* ada-valprint.c: Likewise.
-
-2004-10-08  Corinna Vinschen  <vinschen@redhat.com>
-
-	* infcall.c (call_function_by_hand): Use correct VALUE_TYPE macro.
-
-2004-10-08  Nick Roberts  <nickrob@snap.net.nz>
-
-	* MAINTAINERS: Update e-mail address.
-
-2004-10-07  Daniel Jacobowitz  <dan@debian.org>
-
-	From Maciej W. Rozycki  <macro@mips.com>:
-	* mips-tdep.c (mips32_next_pc): Check the register's contents,
-	not its number for BLEZ/BLEZL and BGTZ/BGTZL.
-
-2004-10-07  Kei Sakamoto  <sakamoto.kei@renesas.com>
-
-	* m32r-tdep.c (decode_prologue): Support functions written
-	in assembler language. Recognize trap instructions as the
-	end of prologue.
-	(m32r_frame_unwind_cache): Ditto.
-	(m32r_skip_prologue): Extend search limit. Quit analyzing
-	prologue if pc's location is not readable.
-
-2004-10-06  Paul N. Hilfinger  <Hilfinger@gnat.com>
-
-	* Makefile.in (.l.c): Do conversions of names of alloc and free 
-	functions that are done for .y.c files, plus special one
-	for yy_flex_realloc.  Also, correct missing-file tests here.
-	* ada-lex.l (malloc, free): Remove macros.
-	(resize_tempbuf): Use "realloc"; rely on sed changes to convert to
-	xrealloc.
-	(ada_flex_use): Dummy definition to remove warnings about unused
-	functions.
-	* ada-exp.y (dummy_string_to_ada_operator): Temporary definition
-	to suppress warning.
-	
-2004-10-06  Corinna Vinschen  <vinschen@redhat.com>
-
-	* sh-tdep.c (sh_return_value_nofpu): New function, implementing
-	RETURN_VALUE.
-	(sh_return_value_fpu): Ditto for CPUs with FPU.
-	(sh_gdbarch_init): Remove STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE,
-	RETURN_VALUE_ON_STACK and USE_STRUCT_CONVENTION throughout.
-	Install sh_return_value_nofpu resp. sh_return_value_fpu as
-	RETURN_VALUE functions.
-
-2004-10-06  Corinna Vinschen  <vinschen@redhat.com>
-
-	* sh-tdep.c (sh_pseudo_register_read): Add PSEUDO_BANK_REGNUM handling. 
-	(sh_pseudo_register_write): Ditto.
-
-2004-10-06  Corinna Vinschen  <vinschen@redhat.com>
-
-	* sh-tdep.c (IS_MACL_STS): New define.
-	(IS_MOVI20): Ditto.
-	(IS_MACL_LDS): Ditto.
-	(sh_analyze_prologue): Recognize STS.L MACL,@-r15 and MOVI20
-	instructions in prologue.
-	(sh_in_function_epilogue_p): Recognize LDS.L @r15+,MACL and MOVI20
-	instructions in epilogue.
-
-2004-10-06  Corinna Vinschen  <vinschen@redhat.com>
-
-	* sh-tdep.c (SH_NUM_REGS): Define as 67.
-	(sh_sh_register_name): Add eight empty register names.
-	(sh_sh3_register_name): Ditto.
-	(sh_sh3e_register_name): Ditto.
-	(sh_sh2e_register_name): Ditto.
-	(sh_sh2a_register_name): New function, defining SH2A register set.
-	(sh_sh2a_nofpu_register_name): New function, defining SH2A register set
-	in nofpu case.
-	(sh_sh_dsp_register_name): Add eight empty register names.
-	(sh_sh3_dsp_register_name): Ditto.
-	(sh_sh4_register_name): Ditto.
-	(sh_sh4_nofpu_register_name): Ditto.
-	(sh_sh4al_dsp_register_name): Ditto.
-	(sh2a_show_regs): New function.
-	(sh2a_nofpu_show_regs): New function.
-	(sh_sh2a_register_type): New function.
-	(do_bank_register_info): New function.
-	(sh_print_pseudo_register): Call do_bank_register_info.
-	Call sh_print_pseudo_register for valid "bank" register.
-	(sh_sh2a_register_sim_regno): New function.
-	(sh_gdbarch_init): Add bfd_mach_sh2a and bfd_mach_sh2a_nofpu handling.
-	Increment pseudo register count by one for all sh variants with
-	pseudo registers to accomodate pseudo bank register.
-	* sh-tdep.h: Add register numbers for R0_BANK0_REGNUM, MACHB_REGNUM,
-	IVNB_REGNUM, PRB_REGNUM, GBRB_REGNUM, MACLB_REGNUM, BANK_REGNUM,
-	IBCR_REGNUM, IBNR_REGNUM, TBR_REGNUM and PSEUDO_BANK_REGNUM. 
-	Increment pseudo register numbers.
-
-2004-10-06  Corinna Vinschen  <vinschen@redhat.com>
-
-	* dwarf2read.c (read_subroutine_type): Call make_function_type
-	instead of lookup_function_type.
-
-2004-10-05  Jim Blandy  <jimb@redhat.com>
-
-	* linux-nat.c (_initialize_linux_nat): Rename child_ops.
-	(Previous change missed some uses.)
-
-2004-10-05  Andrew Cagney  <cagney@gnu.org>
-
-	* target.h (deprecated_child_ops): Rename child_ops.
-	* wince.c: Update copyright.  Rename child_ops.
-	* win32-nat.c: Rename child_ops.
-	* target.c: Rename child_ops.
-	* rs6000-nat.c: Rename child_ops.
-	* linux-nat.c: Rename child_ops.
-	* infttrace.c: Rename child_ops.
-	* inftarg.c: Rename child_ops.
-	* infptrace.c: Rename child_ops.
-	* hppah-nat.c: Update copyright.  Rename child_ops.
-	* hpux-thread.c: Update copyright.  Rename child_ops.
-
-2004-10-05  Daniel Jacobowitz  <dan@debian.org>
-
-	* remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY.
-
-2004-10-05  Andrew Cagney  <cagney@gnu.org>
-
-	* version.in: Bump to version 6.2.50_YYYY-MM-DD-cvs.
-
-2004-10-05  Daniel Jacobowitz  <dan@debian.org>
-
-	* dwarf2read.c (REF_HASH_SIZE): Move earlier.
-	(die_ref_table): Remove.
-	(struct dwarf2_cu): Add DIES, DEPENDENCIES, and DIE_REF_TABLE.
-	(struct dwarf2_per_cu_data): Add PSYMTAB.  Add a comment describing
-	the usage of this type.
-	(struct dwarf2_per_objfile): Update comment for ALL_COMP_UNITS.
-	(struct dwarf2_pinfo, PST_PRIVATE, DWARF_INFO_OFFSET): Remove.
-	(struct dwarf2_queue_item, dwarf2_queue, dwarf2_queue_tail): New.
-	(dwarf2_create_include_psymtab): Update comment.
-	(find_partial_die): Remove third argument.  Remove unreachable call
-	to error ().
-	(dwarf2_find_containing_comp_unit): Update comments.  Change one
-	assertion to an error.  Remove an unreachable error.
-	(dwarf2_find_comp_unit): Update comments.
-	(type_at_offset): Remove dead code.
-	(make_cleanup_free_die_list, dwarf2_empty_hash_tables): Remove.
-	(store_in_ref_table): Add CU argument.
-	(follow_die_ref): Take DIE, attribute, and CU arguments.  Handle
-	inter-compilation-unit references.
-	(load_full_comp_unit, process_full_comp_unit): New functions, based
-	on psymtab_to_symtab_1.
-	(psymtab_to_symtab_1): Use them.
-	(dwarf2_add_dependence): New function.
-	(dwarf2_build_psymtabs_hard): Set the psymtab in per_cu.  Always create
-	a per_cu structure, and save it in READ_PSYMTAB_PRIVATE.
-	(partial_die_parent_scope, guess_structure_name): Update for changes
-	to find_partial_die.
-	(dwarf2_psymtab_to_symtab): Initialize dwarf2_per_objfile here.
-	(queue_comp_unit, process_queue, dwarf2_release_queue): New.
-	(read_comp_unit): Don't call dwarf2_empty_hash_tables.
-	(read_die_and_children): Update call to store_in_ref_table.
-	(do_free_die_list_cleanup): Remove.
-	(fixup_partial_die): Update for changes to find_partial_die.
-	(read_full_die): Handle queueing absolute references.
-	(read_attribute_value): Use DW_ADDR for all DW_FORM_ref* forms.
-	(dwarf2_attr, die_specification, die_type)
-	(die_containing_type, dwarf2_extension): Update calls to
-	follow_die_ref.
-	(dump_die): Update DW_FORM_ref* handling.
-	(dwarf2_get_ref_die_offset): Likewise.
-	(free_one_comp_unit): Release the dies list.
-	(dwarf2_mark_helper): New function.
-	(dwarf2_mark): Use it.
-
-2004-10-05  Mark Kettenis  <kettenis@jive.nl>
-
-	* procfs.c (procfs_xfer_partial): Use WRITEBUF instead of READBUF
-	when writing to memory.
-
-2004-10-05  Kei Sakamoto  <sakamoto.kei@renesas.com>
-
-	* m32r-tdep.c (m32r_use_struct_convention): Delete function.
-	(m32r_extract_struct_value_address): Delete function.
-	(m32r_return_value): New function.
-	(m32r_gdbarch_init): Instead of store_return_value,
-	extract_return_value, deprecated_extract_struct_value_address
-	and deprecated_use_struct_convention, set return_value.
-
-2004-10-03  Daniel Jacobowitz  <dan@debian.org>
-
-	* dwarf2read.c (read_subrange_type): Add comment for variable
-	sized arrays.
-
-2004-10-03  Paul Hilfinger  <hilfingr@nile.gnat.com>
-
-	* Makefile.in (.l.c): Modify rule for compatibility with recent
-	versions of flex, and remove most command-line options.
-	* ada-lex.l: Add %options line in place of -I -i and -s command-line
-	options.
-
-2004-10-02  Paul N. Hilfinger  <Hilfinger@gnat.com>
-
-        Turn on initial Ada support (mainly expression evaluation).
-	
-        * Makefile.in (SFILES): Remove ada-tasks.c.
-	(HFILES_NO_SRCDIR): Add ada-lang.h.
-	(COMMON_OBS): Add ada-lang.o, ada-typeprint.o, ada-valprint.o.
-	(YYOBJ): Add ada-exp.o.
-	(rule .l.c): Generalize to not mention ada.
-	* symtab.c: Include ada-lang.h.
-	(symbol_natural_name, symbol_demangled_name)
-	(symbol_search_name): Add Ada case.
-
-2004-10-01  Andrew Cagney  <cagney@gnu.org>
-
-	* Makefile.in (COMMON_OBS): Add inf-child.o.
-	* config/vax/obsd.mh (NATDEPFILES): Remove inf-child.o.
-	* config/vax/nbsdelf.mh (NATDEPFILES): Remove inf-child.o.
-	* config/vax/nbsdaout.mh (NATDEPFILES): Remove inf-child.o.
-	* config/powerpc/nbsd.mh (NATDEPFILES): Remove inf-child.o.
-	* config/m88k/obsd.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/obsdaout.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/obsd64.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/obsd.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/nbsdelf.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/nbsdaout.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/nbsd64.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/fbsd64.mh (NATDEPFILES): Remove inf-child.o.
-	* config/i386/fbsd.mh (NATDEPFILES): Remove inf-child.o.
-
-	* target.c (xfer_using_stratum): Change return type to LONGEST.
-	On each iteration offset, readbuf and writebuf.
-	* inf-ptrace.c (inf_ptrace_xfer_partial): Simplify computation of
-	partial_length, and read/modify/write predicate, update comments.
-	Pass buffer.word to ptrace write.
-
-2004-10-01  Paul N. Hilfinger  <Hilfinger@gnat.com>
-
-	* symfile.c (init_filename_language_table): Add extensions for
-	Ada.
-	* defs.h (enum language): Add language_ada.
-	* gdbtypes.h (TYPE_FLAG_FIXED_INSTANCE): Define.
-	* ada-lang.c: Strip code that is conditionalized out by GNAT_GDB.
-	(add_symbols_from_enclosing_procs): Make a no-op for now.
-	(ada_unqualified_name,add_angle_brackets,function_name_from_pc)
-	(extended_canonical_line_spec, find_sal_from_funcs_and_line)
-	(find_line_in_linetable, find_next_line_in_linetable)
-	(read_all_symtabs, is_plausible_func_for_line)
-	(adjust_pc_past_prologue, error_breakpoint_runtime_sym_not_found)
-	(is_runtime_sym_defined, check_size): Remove declaration.
-	(function_name_from_pc, ada_translate_error_message)
-	(ada_lookup_minimal_symbol): Remove definition.
-	(ada_add_block_symbols): Remove useless label.
-	* ada-lang.h (ada_maybe_exception_partial_symbol): Remove 
-	useless declaration.
-	(ada_is_exception_sym): Likewise.
-
-2004-09-30    Kei Sakamoto  <sakamoto.kei@renesas.com>
-
-	Add m32r-linux support.
-	* configure.tgt: Add m32r*-*-linux*.
-	* Makefile.in (ALLDEPFILES): Add m32r-tdep.c, m32r-linux-nat.c
-	and m32r-linux-tdep.c.
-	(m32r-linux-nat.o, m32r-linux-tdep.o): New dependencies.
-	* m32r-tdep.c: Move some definitions to m32r-tdep.h.
-	* config/djgpp/fnchange.lst: Add m32r-linux-nat.c and
-	m32r-linux-tdep.c.
-	* m32r-tdep.h, m32r-linux-nat.c, m32r-linux-tdep.c,
-	config/m32r/linux.mh, config/m32r/linux.mt,
-	config/m32r/nm-linux.h: New files.
-
-2004-09-30  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips32_decode_reg_save): Remove, unused.
-	(mips32_fetch_instruction): Remove, unused.
-
-2004-09-30  Joel Brobecker  <brobecker@gnat.com>
-
-	* mips-tdep.c (mips_insn16_frame_cache): Remove dead code or
-	conditions that will always be true.
-
-2004-09-30  Mark Kettenis  <kettenis@gnu.org>
-
-	* vaxbsd-nat.c: Include "target,h" and "inf-ptrace.h".
-	(vaxbsd_fetch_inferior_registers): Rename from
-	fetch_inferior_registers.  Make static.
-	(vaxbsd_store_inferior_registers): Rename from
-	store_inferior_registers.  Make static.
-	(_initialize_vaxbsd_nat): Construct and add target vector.
-	* config/vax/nbsdaout.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o.  Add inf-child.o and inf-ptrace.o.
-	* config/vax/nbsdelf.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o.  Add inf-child.o and inf-ptrace.o.
-	(NAT_FILE): Remove.
-	* config/vax/obsd.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o.  Add inf-child.o and inf-ptrace.o.
-	(NAT_FILE): Remove.
-	* Makefile.in (vaxbsd-nat.o): Update dependencies.
-
-	* m88kbsd-nat.c: Include "target.h" and "inf-ptrace.h".
-	(m88kbsd_fetch_inferior_registers): Rename from
-	fetch_inferior_registers.  Make static.
-	(m88kbsd_store_inferior_registers): Rename from
-	store_inferior_registers.  Make static.
-	(_initialize_m88kbsd_nat): New prototype and function.
-	* config/m88k/obsd.mh (NATDEPFILES): Remove infptrace.o and
-	inftarg.o.  Add inf-child.o and inf-ptrace.o.
-	(NAT_FILE): Remove.
-	* Makefile.in (m88kbsd-nat.o): Update dependencies.
-
-2004-09-30  Andrew Cagney  <cagney@gnu.org>
-
-	* target.c (target_xfer_partial): New function.
-	(target_read_memory_partial, target_write_memory_partial) 
-	(default_xfer_partial, target_read_partial, target_write_partial) 
-	(xfer_using_stratum): Use.
-	(debug_to_xfer_partial): Delete function.
-	(setup_target_debug): Do not override to_xfer_partial.
-
-2004-09-30  Mark Kettenis  <kettenis@chello.nl>
-
-	* fork-child.c: Update copyright year.  Fix coding style.
-
-2004-09-29  Mark Kettenis  <kettenis@gnu.org>
-
-	* defs.h (msavestring, mstrsave): Remove prototypes.
-	* utils.c (msavestring, mstrsave): Remove functions.
-	* objfiles.c (allocate_objfile): Use xstrdup instead of mstrsave.
-	* solib-sunos.c (allocate_rt_common_objfile): Use xstrdup instead
-	of mstrsave.
-	* source.c (find_and_open_source): Use xstrdup instead of
-	mstrsave.
-
-2004-09-30  Andrew Cagney  <cagney@gnu.org>
-
-	* inf-ptrace.c (inf_ptrace_target): Do not set to_xfer_memory.
-	(inf_ptrace_xfer_memory): Delete.
-	* target.c (target_xfer_partial_p, xfer_using_stratum): New.
-	(target_read_memory, target_write_memory): Use xfer_using_stratum
-	when target_xfer_partial_p.
-	(debug_target): Move to start of file.
-	(target_read_memory_partial, target_write_memory_partial): Use
-	to_xfer_partial when target_xfer_partial_p.
-
-	* inf-ptrace.c (inf_ptrace_xfer_partial): Replace call to
-	inf_ptrace_xfer_memory with equivalent code.
-	* inftarg.c (child_xfer_partial): When performing a write, pass
-	writebuf to child_xfer_memory.
-
-	* target.c (target_read_string): Use target_read_memory instead of
-	target_xfer_memory.
-
-2004-09-29  Andrew Cagney  <cagney@gnu.org>
-
-	* infptrace.c (kill_inferior): Fix typo, in previous inline.  Pass
-	the address of status.
-
-	* infptrace.c (ptrace_wait): Mention problem with HPUX.
-	(kill_inferior): Inline ptrace_wait call.
-	* linux-nat.c (kill_inferior): Inline ptrace_wait call.
-	* inftarg.c (child_wait): Inline ptrace_wait call.
-
-	* target.h (struct target_ops): Delete field to_post_wait.
-	(target_post_wait): Delete macro.
-	(child_post_wait): Delete declaration.
-	* target.c (update_current_target, update_current_target)
-	(debug_to_post_wait, setup_target_debug): Delete functions and
-	references.
-	* infttrace.c (ptrace_wait): Delete call to target_post_wait.
-	* inftarg.c (child_post_wait): Delete.
-	(init_child_ops): Do not set to_post_wait.
-	* infptrace.c (ptrace_wait): Delete call to target_post_wait.
-	* inf-ptrace.c (inf_ptrace_wait): Delete call to target_post_wait.
-	* inf-child.c (inf_child_post_wait): Delete.
-	(inf_child_target): Do not set to_post_wait.
-	* inf-ptrace.c (inf_ptrace_post_wait): Delete.
-	(inf_ptrace_target): Do not set to_post_wait.
-
-	* wince.c (child_ops): Delete.
-	* win32-nat.c (child_ops): Delete.
-
-	* inftarg.c (inftarg_set_find_memory_regions) 
-	(inftarg_set_make_corefile_notes): Delete functions.
-	(_initialize_linux_nat): Inline calls.
-
-	* target.h (child_ops): Declare.
-	* inftarg.c (child_ops): Move from here ...
-	* target.c (child_ops): ... to here.
-	* wince.c (child_ops): Delete extern declaration.
-	* win32-nat.c (child_ops): Delete extern declaration.
-	* linux-nat.c (child_ops): Delete extern declaration.
-	* hpux-thread.c (child_ops): Delete extern declaration.
-
-2004-09-28  Mark Kettenis  <kettenis@gnu.org>
-
-	* configure.tgt: Set default OS/ABI for OpenBSD ELF targets.
-
-2004-09-28  Mark Kettenis  <kettenis@gnu.org>
-
-	* configure.in: Only set host_makefile_frag when building a native
-	debugger.
-	* configure: Regenerate.
-
-	* alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Register OS/ABI
-	for OpenBSD ELF.
-
-2004-09-28  Andrew Cagney  <cagney@gnu.org>
-
-	Problem identified by Paul Hilfinger.
-	* Makefile.in (ada_lex_c): Define.
-	(ada-lex.o): Delete rule.
-
-	* linux-proc.c: Delete file.
-	* Makefile.in: Update.
-	* config/sparc/linux64.mh (NATDEPFILES): 
-	* config/sparc/linux.mh (NATDEPFILES): Update.
-	* config/s390/s390.mh (NATDEPFILES): Update.
-	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Update.
-	* config/powerpc/linux.mh (NATDEPFILES): Update.
-	* config/pa/linux.mh (NATDEPFILES): Update.
-	* config/mips/linux.mh (NATDEPFILES): Update.
-	* config/m68k/linux.mh (NATDEPFILES): Update.
-	* config/ia64/linux.mh (NATDEPFILES): Update.
-	* config/i386/linux64.mh (NATDEPFILES): Update.
-	* config/i386/linux.mh (NATDEPFILES): Update.
-	* config/arm/linux.mh (NATDEPFILES): Update.
-	* config/alpha/alpha-linux.mh (NATDEPFILES): Update.
-	* linux-nat.c: Update copyright.  Include <sys/param.h>,
-	<sys/procfs.h>, "elf-bfd.h", "gregset.h", <ctype.h>,
-	"gdbthread.h", "gdb_stat.h", <fcntl.h>.
-	(O_LARGEFILE): Possibly define.
-	(_initialize_linux_nat, linux_proc_pending_signals)
-	(add_line_to_sigset, linux_proc_xfer_memory)
-	(linux_nat_info_proc_cmd, linux_nat_make_corefile_notes)
-	(linux_nat_do_registers, linux_nat_corefile_thread_callback)
-	(struct linux_corefile_thread_data)
-	(linux_nat_do_thread_registers, linux_nat_find_memory_regions)
-	(child_pid_to_exec_file): Insert code previously in linux-proc.c.
-
-2004-09-16  Andrew Cagney  <cagney@gnu.org>
-
-	* lin-lwp.c: Delete file.
-	* linux-nat.c: Include "gdb_assert.h", "gdb_string.h", <unistd.h>,
-	<sys/syscall.h>, "gdbthread.h", "gdbcmd.h", "regcache.h".
-	(status_to_str, init_lwp_list, add_lwp, delete_lwp)
-	(find_lwp_pid, iterate_over_lwps, lin_lwp_attach_lwp)
-	(linux_nat_attach, detach_callback, linux_nat_detach)
-	(resume_callback, resume_clear_callback, linux_nat_resume)
-	(kill_lwp, linux_nat_handle_extended, wait_lwp, stop_callback)
-	(stop_wait_callback, linux_nat_has_pending, flush_callback)
-	(status_callback, running_callback, count_events_callback)
-	(select_singlestep_lwp_callback, select_event_lwp_callback)
-	(cancel_breakpoints_callback, select_event_lwp, resumed_callback)
-	(child_wait, stop_and_resume_callback, linux_nat_wait)
-	(kill_callback, kill_wait_callback, linux_nat_kill)
-	(linux_nat_create_inferior, linux_nat_mourn_inferior)
-	(linux_nat_xfer_memory, linux_nat_thread_alive)
-	(linux_nat_pid_to_str, init_linux_nat_ops, sigchld_handler)
-	(_initialize_linux_nat): New functions.
-	* Makefile.in: Update all dependencies.
-	* config/sparc/linux64.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/sparc/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/s390/s390.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/powerpc/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/pa/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/mips/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/m68k/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/ia64/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/i386/linux64.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/i386/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/arm/linux.mh (NATDEPFILES): Remove lin-lwp.o.
-	* config/alpha/alpha-linux.mh (NATDEPFILES): Remove lin-lwp.o.
-
-2004-09-27  Mark Kettenis  <kettenis@gnu.org>
-
-	* config/i386/fbsd64.mh, config/i386/nbsd64.mh,
-	config/i386/obsd64.mh (NAT_FILE): Remove variable.
-
-	* configure.in: Don't comment out NATDEPFILES in the generated
-	Makefile if NAT_FILE is unset.
-	* configure: Regenerate.
-
-2004-09-27  Andrew Cagney  <cagney@gnu.org>
-
-	* infrun.c (check_for_old_step_resume_breakpoint): Delete.
-	(insert_step_resume_breakpoint): Delete.
-	(insert_step_resume_breakpoint_at_frame): New function.
-	(insert_step_resume_breakpoint_at_sal): New function.
-	(handle_inferior_event, step_into_function)
-	(insert_step_resume_breakpoint): Simplify by using same.
-
-	* gdb_indent.sh (types): Add caddr_t to list of predefined types.
-
-2004-09-26  Mark Kettenis  <kettenis@gnu.org>
-
-	* fbsd-proc.c: Remove file.
-	* Makefile.in (fbsd-proc.o): Remove dependency.
-
-	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Group target related
-	code together.
-
-	* config/i386/nm-fbsd64.h: Remove file.
-	* config/i386/fbsd64.mh (NAT_FILE): Set to config/nm-nbsd.h.
-
-2004-09-26  Mark Kettenis  <kettenis@gnu.org>
-
-	* amd64-nat.h: Update copyright year.
-	(amd64bsd_target): New prototype.
-	* amd64bsd-nat.c: Include "target.h" and "inf-ptrace.h".
-	(amd64bsd_target): New function.
-	(amd64bsd_fetch_inferior_registers): Rename from
-	fetch_inferior_registers.  Make static.
-	(amd64bsd_store_inferior_registers): Rename from
-	store_inferior_registers.  Make static.
-	* amd64fbsd-nat.c: Include "target.h" and "fbsd-nat.h".
-	(_initialize_amd64fbsd_nat): Construct and add target vector.
-	* amd64nbsd-nat.o: Include "target.h".
-	(_initialize_amd64nbsd_nat): Construct and add target vector.
-	* amd64obsd-nat.c: Include "target.h".
-	(_initialize_amd64obsd_nat): Construct and add target vector.
-	* config/i386/nm-fbsd64.h (CHILD_PID_TO_EXEC_FILE): Remove define.
-	* config/i386/fbsd64.mh (NATDEPFILES): Remove infptrace.o,
-	inftarg.o and fbsd-proc.o.  Add inf-child.o, inf-ptrace.o and
-	fbsd-nat.o.
-	* config/i386/nbsd64.mh, config/i386/obsd64.mh (NATDEPFILES):
-	Remove infptrace.o and inftarg.o.  Add inf-child.o and
-	inf-ptrace.o.
-	* Makefile.in (amd64bsd-nat.o, amd64fbsd-nat.o, amd64nbsd-nat.o)
-	(amd64obsd-nat.o): Update dependencies.
-
-2004-09-25  Mark Kettenis  <kettenis@gnu.org>
-
-	* config/i386/fbsd.mh (NATDEPFILES): Remove infptrace.o.
-	* config/i386/nbsdaout.mh (NATDEPFILES): Remove infptrace.o.
-	* config/i386/nbsdelf.mh (NATDEPFILES): Remove infptrace.o.
-	* config/i386/obsd.mh (NATDEPFILES): Remove infptrace.o.
-	* config/i386/obsdaout.mh (NATDEPFILES): Remove infptrace.o.
-
-	* inf-ptrace.c (inf_ptrace_attach): Remove redundant parenthesis.
-	Inline attach call.
-	(inf_ptrace_detach): Inline detach call.
-
-	* configure.in: Check for waddstr instead of mvwaddstr when
-	searching for curses library.  Check for wborder.
-	* configure, config.in: Regenerate.
-	* tui/tui-wingeneral.c (box_win): Use box if wborder isn't
-	available.
-
-	* inf-ptrace.c (inf_ptrace_xfer_memory): Fix gdb_indent.sh wart.
-
-2004-09-24  Robert Picco <Robert.Picco@hp.com>
-
-	Committed by Andrew Cagney.
-	* remote.c (set_remote_protocol_p_packet_cmd, remote_protocol_p)
-	(show_remote_protocol_p_packet_cmd): New.  Implement 'p' packet.
-	configuration.
-	(fetch_register_using_p): Implement 'p' packet.  Based on code by
-	Fernando Nasser.
-	(remote_fetch_registers): Call fetch_register_using_p.
-	(init_all_packet_configs, show_remote_cmd)
-	(_initialize_remote): Add p-packet.
-
-2004-09-24  Mark Kettenis  <kettenis@gnu.org>
-
-	* inf-ptrace.c (inf_ptrace_kill_inferior): Call ptrace directly
-	instead of call_ptrace.  Call wait directly instead of
-	ptrace_wait.
-	(inf_ptrace_me): Call ptrace directly instead of call_ptrace.
-	(inf_ptrace_wait): Inline ptrace_wait call.
-
-2004-09-24  Paul Hilfinger  <hilfingr@nile.gnat.com>
-
-	* Makefile.in (.y.c): Revert previous change.  ../ylwrap was 
-	rolled back instead.
-
-2004-09-24  Paul Hilfinger  <hilfingr@nile.gnat.com>
-
-	* Makefile.in (.y.c): Modify $(YLWRAP) invocation to use
-	the new argument order.
-
-2004-09-23  Corinna Vinschen  <vinschen@redhat.com>
-
-	* MAINTAINERS: Remove "broken" from XStormy16 entry.
-	* xstormy16-tdep.c: Convert XStormy16 target to latest GDB methods.
-	(struct gdbarch_tdep): Remove.
-	(struct xstormy16_frame_cache): New frame cache structure.
-	(xstormy16_register_byte, xstormy16_register_raw_size)
-	(xstormy16_reg_virtual_type, xstormy16_register_type)
-	(xstormy16_push_arguments, xstormy16_push_return_address)
-	(xstormy16_pop_frame, xstormy16_store_struct_return)
-	(xstormy16_store_return_value, xstormy16_extract_struct_value_address)
-	(xstormy16_frame_saved_register, xstormy16_get_saved_register)
-	(xstormy16_scan_prologue, xstormy16_frame_init_saved_regs)
-	(xstormy16_frame_saved_pc, xstormy16_init_extra_frame_info)
-	(xstormy16_frame_chain, xstormy16_frame_chain_valid,
-	(xstormy16_saved_pc_after_call, xstormy16_save_dummy_frame_to): Remove.
-	(xstormy16_use_struct_convention): Drop gcc_p parameter.
-	(xstormy16_extract_return_value, xstormy16_store_return_value):
-	Regcachify.  Drop useless struct convention handling.
-	(xstormy16_register_type, xstormy16_return_value)
-	(xstormy16_push_dummy_call, xstormy16_analyze_prologue)
-	(xstormy16_alloc_frame_cache, xstormy16_frame_cache)
-	(xstormy16_frame_prev_register, xstormy16_frame_this_id)
-	(xstormy16_frame_base_address, xstormy16_frame_sniffer)
-	(xstormy16_unwind_sp, xstormy16_unwind_pc)
-	(xstormy16_unwind_dummy_id) : New functions.
-	(xstormy16_skip_prologue): Call xstormy16_analyze_prologue instead
-	of xstormy16_scan_prologue.
-	(xstormy16_frame_unwind): New frame_unwind structure.
-	(xstormy16_frame_base): New frame_base structure.
-	(xstormy16_gdbarch_init): Accomodate all of the above changes.
-	Reshuffle for better readability.  Also add dwarf2_frame_sniffer.
-
-2004-09-22  Mark Kettenis  <kettenis@gnu.org>
-
-	* language.c (language_gdbarch_post_init): Fix off-by one error.
-
 2004-09-21  Daniel Jacobowitz  <dan@debian.org>
 
 	* dwarf2read.c (struct dwarf2_per_cu_data): New field type_hash.
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 30a305f..e24a577 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -150,7 +150,7 @@
 	x86-64		--target=x86_64-linux-gnu ,-Werror
 			Maintenance only
 
-	xstormy16	--target=xstormy16-elf
+	xstormy16	--target=xstormy16-elf broken
 			Corinna Vinschen	vinschen@redhat.com
 
 	z8k		Deleted.
@@ -217,17 +217,22 @@
                         For the part of top.c related to the event loop,
                         send questions to ezannoni@redhat.com
 
-generic symtabs		Elena Zannoni		ezannoni@redhat.com
-  dwarf readers		Elena Zannoni		ezannoni@redhat.com
-  elf reader		Elena Zannoni		ezannoni@redhat.com
-  stabs reader		Elena Zannoni		ezannoni@redhat.com
+generic symtabs		Jim Blandy		jimb@redhat.com
+			Elena Zannoni		ezannoni@redhat.com
+  dwarf readers		Jim Blandy		jimb@redhat.com
+			Elena Zannoni		ezannoni@redhat.com
+  elf reader		Jim Blandy		jimb@redhat.com
+			Elena Zannoni		ezannoni@redhat.com
+  stabs reader		Jim Blandy		jimb@redhat.com
+			Elena Zannoni		ezannoni@redhat.com
   coff reader		Philippe De Muyter	phdm@macqel.be
   xcoff reader		Any maintainer can modify this; please send tricky
 			ones to Kevin Buettner <kevinb@redhat.com>
   HP/UX readers		Any [past] maintainer can modify this.
 			Please send tricky ones to the symtabs maintainers.
 
-tracing bytecode stuff  (Global Maintainers)
+tracing bytecode stuff  Jim Blandy              jimb@redhat.com
+                        (Global Maintainers)
 tracing			Michael Snyder		msnyder@redhat.com
 threads			Michael Snyder		msnyder@redhat.com
 			Mark Kettenis		kettenis@gnu.org
@@ -381,7 +386,7 @@
 David O'Brien					obrien@freebsd.org
 Alexandre Oliva					aoliva@redhat.com
 Tom Rix						trix@redhat.com
-Nick Roberts					nickrob@snap.net.nz
+Nick Roberts					nick@nick.uklinux.net
 Bob Rossi 					bob_rossi@cox.net
 Theodore A. Roth				troth@openavr.org
 Ian Roxborough					irox@redhat.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 3546113..f148868 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -510,7 +510,7 @@
 # Links made at configuration time should not be specified here, since
 # SFILES is used in building the distribution archive.
 
-SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c  \
+SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
 	ax-general.c ax-gdb.c \
 	bcache.c \
 	bfd-target.c \
@@ -625,7 +625,6 @@
 #
 
 ada_lang_h = ada-lang.h $(value_h) $(gdbtypes_h) $(breakpoint_h)
-ada_lex_c = ada-lex.c $(gdb_string_h)
 alphabsd_tdep_h = alphabsd-tdep.h
 alpha_tdep_h = alpha-tdep.h
 amd64_nat_h = amd64-nat.h
@@ -656,7 +655,7 @@
 dcache_h = dcache.h
 defs_h = defs.h $(config_h) $(ansidecl_h) $(gdb_locale_h) $(gdb_signals_h) \
 	$(libiberty_h) $(bfd_h) $(ui_file_h) $(xm_h) $(nm_h) $(tm_h) \
-	$(fopen_bin_h) $(gdbarch_h)
+	$(fopen_same_h) $(gdbarch_h)
 dictionary_h = dictionary.h
 disasm_h = disasm.h
 doublest_h = doublest.h $(floatformat_h)
@@ -720,7 +719,6 @@
 linespec_h = linespec.h
 linux_nat_h = linux-nat.h $(target_h)
 m2_lang_h = m2-lang.h
-m32r_tdep_h = m32r-tdep.h
 m68k_tdep_h = m68k-tdep.h
 m88k_tdep_h = m88k-tdep.h
 macroexp_h = macroexp.h
@@ -848,7 +846,7 @@
 	symfile.h symfile-mem.h stabsread.h target.h terminal.h typeprint.h \
 	xcoffsolib.h \
 	macrotab.h macroexp.h macroscope.h \
-	ada-lang.h c-lang.h f-lang.h \
+	c-lang.h f-lang.h \
 	jv-lang.h \
 	m2-lang.h  p-lang.h \
 	complaints.h valprint.h \
@@ -895,7 +893,6 @@
 	infcall.o \
 	infcmd.o infrun.o \
 	expprint.o environ.o stack.o thread.o \
-	inf-child.o \
 	interps.o \
 	main.o \
 	macrotab.o macrocmd.o macroexp.o macroscope.o \
@@ -910,7 +907,7 @@
 	dbxread.o coffread.o coff-pe-read.o elfread.o \
 	dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
 	dwarf2expr.o dwarf2loc.o dwarf2-frame.o \
-	ada-lang.o c-lang.o f-lang.o objc-lang.o \
+	c-lang.o f-lang.o objc-lang.o \
 	ui-out.o cli-out.o \
 	varobj.o wrapper.o \
 	jv-lang.o jv-valprint.o jv-typeprint.o \
@@ -918,8 +915,8 @@
 	scm-exp.o scm-lang.o scm-valprint.o \
 	sentinel-frame.o \
 	complaints.o typeprint.o \
-	ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o \
-	ada-valprint.o c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
+	c-typeprint.o f-typeprint.o m2-typeprint.o \
+	c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
 	nlmread.o serial.o mdebugread.o top.o utils.o \
 	ui-file.o \
 	user-regs.o \
@@ -943,7 +940,6 @@
 	f-exp.c m2-exp.c p-exp.c
 YYOBJ = c-exp.o \
 	objc-exp.o \
-	ada-exp.o \
 	jv-exp.o \
 	f-exp.o m2-exp.o p-exp.o
 
@@ -1385,8 +1381,6 @@
 	libunwind-frame.c \
 	lynx-nat.c m3-nat.c \
 	m68hc11-tdep.c \
-	m32r-tdep.c \
-	m32r-linux-nat.c m32r-linux-tdep.c \
 	m68k-tdep.c \
 	m68kbsd-nat.c m68kbsd-tdep.c \
 	m88k-tdep.c m88kbsd-nat.c \
@@ -1575,31 +1569,21 @@
 	     -e '/extern.*realloc/d' \
 	     -e '/extern.*free/d' \
 	     -e '/include.*malloc.h/d' \
-	     -e 's/\([^x]\)malloc/\1xmalloc/g' \
-	     -e 's/\([^x]\)realloc/\1xrealloc/g' \
+	     -e 's/malloc/xmalloc/g' \
+	     -e 's/realloc/xrealloc/g' \
 	     -e '/^#line.*y.tab.c/d' \
 	  < $@.tmp > $@.new
 	-rm $@.tmp
 	mv $@.new ./$*.c
 .l.c:
-	if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
-	    $(FLEX) -o$@ $< && \
-	    rm -f $@.new && \
-	    sed -e '/extern.*malloc/d' \
-	        -e '/extern.*realloc/d' \
-	        -e '/extern.*free/d' \
-	        -e '/include.*malloc.h/d' \
-	        -e 's/\([^x]\)malloc/\1xmalloc/g' \
-	        -e 's/\([^x]\)realloc/\1xrealloc/g' \
-		-e 's/yy_flex_xrealloc/yyxrealloc/g' \
-	      < $@ > $@.new && \
-	    rm -f $@ && \
-	    mv $@.new $@; \
-	elif [ -f $@ ]; then \
-	    echo "Warning: $*.c older than $*.l and flex not available."; \
-	else \
-	    echo "$@ missing and flex not available."; \
+	@if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
+	    echo $(FLEX) -Isit $< ">" $@; \
+	    $(FLEX) -Isit $< > $@; \
+	elif [ ! -f $@ -a ! -f $< ]; then \
+	    echo "ada-lex.c missing and flex not available."; \
 	    false; \
+	elif [ ! -f $@ ]; then \
+	    echo "Warning: $*.c older than $*.l and flex not available."; \
 	fi
 
 .PRECIOUS: ada-exp.c ada-lex.c
@@ -1626,6 +1610,7 @@
 	$(gdbcore_h) $(hashtab_h) $(gdb_obstack_h) $(ada_lang_h) \
 	$(completer_h) $(gdb_stat_h) $(ui_out_h) $(block_h) $(infcall_h) \
 	$(dictionary_h)
+ada-lex.o: ada-lex.c $(gdb_string_h)
 ada-typeprint.o: ada-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \
 	$(symtab_h) $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) \
 	$(target_h) $(command_h) $(gdbcmd_h) $(language_h) $(demangle_h) \
@@ -1661,11 +1646,9 @@
 	$(regcache_h) $(reggroups_h) $(arch_utils_h) $(osabi_h) $(block_h) \
 	$(infcall_h) $(elf_bfd_h) $(alpha_tdep_h)
 amd64bsd-nat.o: amd64bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) \
-	$(inf_ptrace_h)
+	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h)
 amd64fbsd-nat.o: amd64fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(target_h) $(gdb_assert_h) $(fbsd_nat_h) $(amd64_tdep_h) \
-	$(amd64_nat_h) $(bsd_kvm_h)
+	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
 amd64fbsd-tdep.o: amd64fbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) \
 	$(amd64_tdep_h) $(solib_svr4_h)
@@ -1678,14 +1661,13 @@
 	$(solib_svr4_h)
 amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(amd64_tdep_h)
-amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(target_h) $(gdb_assert_h) \
-	$(amd64_tdep_h) $(amd64_nat_h)
+amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) $(amd64_tdep_h) \
+	$(amd64_nat_h)
 amd64nbsd-tdep.o: amd64nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(osabi_h) $(symtab_h) $(gdb_assert_h) $(amd64_tdep_h) \
 	$(nbsd_tdep_h) $(solib_svr4_h)
 amd64obsd-nat.o: amd64obsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
-	$(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) \
-	$(bsd_kvm_h)
+	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
 amd64obsd-tdep.o: amd64obsd-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
 	$(symtab_h) $(objfiles_h) $(osabi_h) $(regset_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(amd64_tdep_h) $(i387_tdep_h) \
@@ -1866,8 +1848,8 @@
 	$(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) $(demangle_h) \
 	$(expression_h) $(filenames_h) $(macrotab_h) $(language_h) \
 	$(complaints_h) $(bcache_h) $(dwarf2expr_h) $(dwarf2loc_h) \
-	$(cp_support_h) $(hashtab_h) $(command_h) $(gdbcmd_h) \
-	$(gdb_string_h) $(gdb_assert_h)
+	$(cp_support_h) $(hashtab_h) $(gdb_string_h) $(gdb_assert_h) \
+	$(command_h) $(gdbcmd_h)
 dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(objfiles_h) \
 	$(elf_dwarf_h) $(buildsym_h) $(demangle_h) $(expression_h) \
 	$(language_h) $(complaints_h) $(gdb_string_h)
@@ -1894,6 +1876,8 @@
 fbsd-nat.o: fbsd-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) \
 	$(regset_h) $(gdb_assert_h) $(gdb_string_h) $(elf_bfd_h) \
 	$(fbsd_nat_h)
+fbsd-proc.o: fbsd-proc.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) \
+	$(regset_h) $(gdb_assert_h) $(gdb_string_h) $(elf_bfd_h)
 f-exp.o: f-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
 	$(parser_defs_h) $(language_h) $(f_lang_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(block_h)
@@ -2004,8 +1988,8 @@
 i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
 	$(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h)
 i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
-	$(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) \
-	$(gnu_nat_h) $(i387_tdep_h) $(gregset_h)
+	$(regcache_h) $(gdb_assert_h) $(i386_tdep_h) $(gnu_nat_h) \
+	$(i387_tdep_h) $(gregset_h)
 i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(osabi_h) $(i386_tdep_h)
 i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
 	$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
@@ -2083,7 +2067,7 @@
 	$(inflow_h)
 inf-ptrace.o: inf-ptrace.c $(defs_h) $(observer_h) $(gdb_ptrace_h) \
 	$(inflow_h) $(inferior_h) $(regcache_h) $(command_h) $(gdbcore_h) \
-	$(inf_child_h) $(gdbcmd_h) $(gdb_string_h) $(gdb_wait_h)
+	$(inf_child_h) $(gdbcmd_h) $(gdb_string_h)
 infptrace.o: infptrace.c $(defs_h) $(command_h) $(frame_h) $(gdbcore_h) \
 	$(inferior_h) $(regcache_h) $(target_h) $(gdb_assert_h) \
 	$(gdb_wait_h) $(gdb_string_h) $(gdb_dirent_h) $(gdb_ptrace_h)
@@ -2130,10 +2114,14 @@
 	$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
 	$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
 	$(objc_lang_h) $(linespec_h)
-linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \
-	$(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \
-	$(gdbcmd_h) $(regcache_h) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
-	$(gdbthread_h) $(gdb_stat_h)
+lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
+	$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) \
+	$(linux_nat_h)
+linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_wait_h) \
+	$(linux_nat_h)
+linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(gdb_stat_h) \
+	$(regcache_h) $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
+	$(cli_decode_h) $(gdb_string_h) $(linux_nat_h)
 lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h)
 m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
@@ -2146,13 +2134,6 @@
 	$(expression_h) $(value_h) $(gdbcore_h) $(target_h) $(m2_lang_h)
 m2-valprint.o: m2-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
 	$(m2_lang_h)
-m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
-	$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
-	$(gregset_h) $(m32r_tdep_h)
-m32r-linux-tdep.o: m32r-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
-	$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
-	$(gdb_string_h) $(glibc_tdep_h) $(solib_svr4_h) $(trad_frame_h) \
-	$(frame_unwind_h) $(m32r_tdep_h)
 m32r-rom.o: m32r-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 	$(serial_h) $(symtab_h) $(command_h) $(gdbcmd_h) $(symfile_h) \
 	$(gdb_string_h) $(objfiles_h) $(inferior_h) $(regcache_h)
@@ -2161,7 +2142,7 @@
 	$(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \
 	$(gdb_string_h) $(value_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
 	$(language_h) $(arch_utils_h) $(regcache_h) $(trad_frame_h) \
-	$(dis_asm_h) $(gdb_assert_h) $(m32r_tdep_h)
+	$(dis_asm_h) $(gdb_assert_h)
 m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
 	$(frame_base_h) $(dwarf2_frame_h) $(trad_frame_h) $(symtab_h) \
 	$(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \
@@ -2188,7 +2169,7 @@
 	$(inferior_h) $(regcache_h) $(arch_utils_h) $(osabi_h) $(dis_asm_h) \
 	$(m68k_tdep_h) $(gregset_h)
 m88kbsd-nat.o: m88kbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(target_h) $(m88k_tdep_h) $(inf_ptrace_h)
+	$(m88k_tdep_h)
 m88k-tdep.o: m88k-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \
 	$(frame_base_h) $(frame_unwind_h) $(gdbcore_h) $(gdbtypes_h) \
 	$(regcache_h) $(regset_h) $(symtab_h) $(trad_frame_h) $(value_h) \
@@ -2531,10 +2512,10 @@
 sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
 	$(sparc_nat_h)
 sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(gdbarch_h) $(osabi_h) \
-	$(sparc64_tdep_h)
+	$(solib_svr4_h) $(sparc64_tdep_h)
 sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
 	$(sparc_nat_h)
-sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
+sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) \
 	$(sparc64_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
 sparc64nbsd-tdep.o: sparc64nbsd-tdep.c $(defs_h) $(frame_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
@@ -2557,8 +2538,8 @@
 	$(gdb_string_h) $(sparc_tdep_h)
 sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \
-	$(sparc_nat_h) $(inf_ptrace_h)
-sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
+	$(sparc_nat_h)
+sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
 	$(sparc_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
 sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
@@ -2609,9 +2590,8 @@
 	$(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
 	$(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
 	$(language_h) $(demangle_h) $(inferior_h) $(linespec_h) $(source_h) \
-	$(filenames_h) $(objc_lang_h) $(ada_lang_h) $(hashtab_h) \
-	$(gdb_obstack_h) $(block_h) $(dictionary_h) $(gdb_string_h) \
-	$(gdb_stat_h) $(cp_abi_h)
+	$(filenames_h) $(objc_lang_h) $(hashtab_h) $(gdb_obstack_h) \
+	$(block_h) $(dictionary_h) $(gdb_string_h) $(gdb_stat_h) $(cp_abi_h)
 target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
 	$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
 	$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h)
@@ -2677,8 +2657,8 @@
 	$(gdb_assert_h) $(regcache_h) $(block_h)
 varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \
 	$(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
-vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
-	$(vax_tdep_h) $(inf_ptrace_h) $(bsd_kvm_h)
+vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+	$(vax_tdep_h) $(bsd_kvm_h)
 vax-nat.o: vax-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) $(vax_tdep_h)
 vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
 	$(vax_tdep_h) $(solib_svr4_h) $(gdb_string_h)
@@ -2703,11 +2683,9 @@
 	$(complaints_h) $(gdb_stabs_h) $(aout_stab_gnu_h)
 xcoffsolib.o: xcoffsolib.c $(defs_h) $(bfd_h) $(xcoffsolib_h) $(inferior_h) \
 	$(gdbcmd_h) $(symfile_h) $(frame_h) $(gdb_regex_h)
-xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(frame_h) $(frame_base_h) \
-	$(frame_unwind_h) $(dwarf2_frame_h) $(symtab_h) $(gdbtypes_h) \
-	$(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) $(inferior_h) \
-	$(gdb_string_h) $(gdb_assert_h) $(arch_utils_h) $(floatformat_h) \
-	$(regcache_h) $(doublest_h) $(osabi_h) $(objfiles_h)
+xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(value_h) $(inferior_h) \
+	$(arch_utils_h) $(regcache_h) $(gdbcore_h) $(objfiles_h) \
+	$(dis_asm_h)
 
 #
 # gdb/cli/ dependencies
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index bb9e41c..73bd120 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -852,7 +852,7 @@
 	  if (end == NULL)
 	    end = suffix + strlen (suffix);
 	  field_name.length = end - suffix;
-	  field_name.ptr = xmalloc (end - suffix + 1);
+	  field_name.ptr = (char *) malloc (end - suffix + 1);
 	  strncpy (field_name.ptr, suffix, end - suffix);
 	  field_name.ptr[end - suffix] = '\000';
 	  suffix = end;
@@ -952,13 +952,3 @@
 {
   obstack_init (&temp_parse_space);
 }
-
-/* FIXME: hilfingr/2004-10-05: Hack to remove warning.  The function
-   string_to_operator is supposed to be used for cases where one
-   calls an operator function with prefix notation, as in 
-   "+" (a, b), but at some point, this code seems to have gone
-   missing. */
-
-struct stoken (*dummy_string_to_ada_operator) (struct stoken) 
-     = string_to_operator;
-
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 275e3a0..0babcca 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -19,6 +19,18 @@
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 
+/* Sections of code marked 
+
+     #ifdef GNAT_GDB 
+     ...
+     #endif
+
+   indicate sections that are used in sources distributed by 
+   ACT, Inc., but not yet integrated into the public tree (where
+   GNAT_GDB is not defined).  They are retained here nevertheless 
+   to minimize the problems of maintaining different versions 
+   of the source and to make the full source available. */
+
 #include "defs.h"
 #include <stdio.h>
 #include "gdb_string.h"
@@ -63,8 +75,27 @@
 #define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
 #endif
 
+#ifdef GNAT_GDB
+/* A structure that contains a vector of strings.
+   The main purpose of this type is to group the vector and its
+   associated parameters in one structure.  This makes it easier
+   to handle and pass around.  */
 
+struct string_vector
+{
+  char **array; /* The vector itself.  */
+  int index;    /* Index of the next available element in the array.  */
+  size_t size;  /* The number of entries allocated in the array.  */
+};
+
+static struct string_vector xnew_string_vector (int initial_size);
+static void string_vector_append (struct string_vector *sv, char *str);
+#endif /* GNAT_GDB */
+
+static const char *ada_unqualified_name (const char *decoded_name);
+static char *add_angle_brackets (const char *str);
 static void extract_string (CORE_ADDR addr, char *buf);
+static char *function_name_from_pc (CORE_ADDR pc);
 
 static struct type *ada_create_fundamental_type (struct objfile *, int);
 
@@ -153,6 +184,9 @@
 static struct type *ada_lookup_struct_elt_type (struct type *, char *,
                                                 int, int, int *);
 
+static char *extended_canonical_line_spec (struct symtab_and_line,
+                                           const char *);
+
 static struct value *evaluate_subexp (struct type *, struct expression *,
                                       int *, enum noside);
 
@@ -194,6 +228,19 @@
 
 static int wild_match (const char *, int, const char *);
 
+static struct symtabs_and_lines
+find_sal_from_funcs_and_line (const char *, int,
+                              struct ada_symbol_info *, int);
+
+static int find_line_in_linetable (struct linetable *, int,
+                                   struct ada_symbol_info *, int, int *);
+
+static int find_next_line_in_linetable (struct linetable *, int, int, int);
+
+static void read_all_symtabs (const char *);
+
+static int is_plausible_func_for_line (struct symbol *, int);
+
 static struct value *ada_coerce_ref (struct value *);
 
 static LONGEST pos_atr (struct value *);
@@ -219,6 +266,8 @@
 
 static struct value *ada_to_fixed_value (struct value *);
 
+static void adjust_pc_past_prologue (CORE_ADDR *);
+
 static int ada_resolve_function (struct ada_symbol_info *, int,
                                  struct value **, int, const char *,
                                  struct type *);
@@ -227,6 +276,10 @@
 
 static int ada_is_direct_array_type (struct type *);
 
+static void error_breakpoint_runtime_sym_not_found (const char *err_desc);
+
+static int is_runtime_sym_defined (const char *name, int allow_tramp);
+
 static void ada_language_arch_info (struct gdbarch *,
 				    struct language_arch_info *);
 
@@ -293,6 +346,69 @@
 
                         /* Utilities */
 
+#ifdef GNAT_GDB
+
+/* Create a new empty string_vector struct with an initial size of
+   INITIAL_SIZE.  */
+
+static struct string_vector
+xnew_string_vector (int initial_size)
+{
+  struct string_vector result;
+
+  result.array = (char **) xmalloc ((initial_size + 1) * sizeof (char *));
+  result.index = 0;
+  result.size = initial_size;
+
+  return result;
+}
+
+/* Add STR at the end of the given string vector SV.  If SV is already
+   full, its size is automatically increased (doubled).  */
+
+static void
+string_vector_append (struct string_vector *sv, char *str)
+{
+  if (sv->index >= sv->size)
+    GROW_VECT (sv->array, sv->size, sv->size * 2);
+
+  sv->array[sv->index] = str;
+  sv->index++;
+}
+
+/* Given DECODED_NAME a string holding a symbol name in its
+   decoded form (ie using the Ada dotted notation), returns
+   its unqualified name.  */
+
+static const char *
+ada_unqualified_name (const char *decoded_name)
+{
+  const char *result = strrchr (decoded_name, '.');
+
+  if (result != NULL)
+    result++;                   /* Skip the dot...  */
+  else
+    result = decoded_name;
+
+  return result;
+}
+
+/* Return a string starting with '<', followed by STR, and '>'.
+   The result is good until the next call.  */
+
+static char *
+add_angle_brackets (const char *str)
+{
+  static char *result = NULL;
+
+  xfree (result);
+  result = (char *) xmalloc ((strlen (str) + 3) * sizeof (char));
+
+  sprintf (result, "<%s>", str);
+  return result;
+}
+
+#endif /* GNAT_GDB */
 
 static char *
 ada_get_gdb_completer_word_break_characters (void)
@@ -319,6 +435,20 @@
   while (buf[char_index - 1] != '\000');
 }
 
+/* Return the name of the function owning the instruction located at PC.
+   Return NULL if no such function could be found.  */
+
+static char *
+function_name_from_pc (CORE_ADDR pc)
+{
+  char *func_name;
+
+  if (!find_pc_partial_function (pc, &func_name, NULL, NULL))
+    return NULL;
+
+  return func_name;
+}
+
 /* Assuming *OLD_VECT points to an array of *SIZE objects of size
    ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
    updating *OLD_VECT and *SIZE as necessary.  */
@@ -430,7 +560,7 @@
 static struct value *
 coerce_unspec_val_to_type (struct value *val, struct type *type)
 {
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   if (VALUE_TYPE (val) == type)
     return val;
   else
@@ -439,7 +569,8 @@
 
       /* Make sure that the object size is not unreasonable before
          trying to allocate some memory for it.  */
-      check_size (type);
+      if (TYPE_LENGTH (type) > varsize_limit)
+        error ("object size is larger than varsize-limit");
 
       result = allocate_value (type);
       VALUE_LVAL (result) = VALUE_LVAL (val);
@@ -478,36 +609,23 @@
    with exactly one argument rather than ...), unless the limit on the
    number of warnings has passed during the evaluation of the current
    expression.  */
-
-/* FIXME: cagney/2004-10-10: This function is mimicking the behavior
-   provided by "complaint".  */
-static void lim_warning (const char *format, ...) ATTR_FORMAT (printf, 1, 2);
-
 static void
-lim_warning (const char *format, ...)
+lim_warning (const char *format, long arg)
 {
-  va_list args;
-  va_start (args, format);
-
   warnings_issued += 1;
   if (warnings_issued <= warning_limit)
-    vwarning (format, args);
-
-  va_end (args);
+    warning (format, arg);
 }
 
-/* Issue an error if the size of an object of type T is unreasonable,
-   i.e. if it would be a bad idea to allocate a value of this type in
-   GDB.  */
-
-static void
-check_size (const struct type *type)
+static const char *
+ada_translate_error_message (const char *string)
 {
-  if (TYPE_LENGTH (type) > varsize_limit)
-    error ("object size is larger than varsize-limit");
+  if (strcmp (string, "Invalid cast.") == 0)
+    return "Invalid type conversion.";
+  else
+    return string;
 }
 
-
 /* Note: would have used MAX_OF_TYPE and MIN_OF_TYPE macros from
    gdbtypes.h, but some of the necessary definitions in that file
    seem to have gone missing. */
@@ -1100,11 +1218,11 @@
 {
   if (type == NULL)
     return NULL;
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   if (type != NULL
       && (TYPE_CODE (type) == TYPE_CODE_PTR
           || TYPE_CODE (type) == TYPE_CODE_REF))
-    return ada_check_typedef (TYPE_TARGET_TYPE (type));
+    return check_typedef (TYPE_TARGET_TYPE (type));
   else
     return type;
 }
@@ -1182,13 +1300,13 @@
         return NULL;
       r = lookup_struct_elt_type (type, "BOUNDS", 1);
       if (r != NULL)
-        return ada_check_typedef (r);
+        return check_typedef (r);
     }
   else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
       r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
       if (r != NULL)
-        return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r)));
+        return check_typedef (TYPE_TARGET_TYPE (check_typedef (r)));
     }
   return NULL;
 }
@@ -1199,7 +1317,7 @@
 static struct value *
 desc_bounds (struct value *arr)
 {
-  struct type *type = ada_check_typedef (VALUE_TYPE (arr));
+  struct type *type = check_typedef (VALUE_TYPE (arr));
   if (is_thin_pntr (type))
     {
       struct type *bounds_type =
@@ -1249,7 +1367,7 @@
   if (TYPE_FIELD_BITSIZE (type, 1) > 0)
     return TYPE_FIELD_BITSIZE (type, 1);
   else
-    return 8 * TYPE_LENGTH (ada_check_typedef (TYPE_FIELD_TYPE (type, 1)));
+    return 8 * TYPE_LENGTH (check_typedef (TYPE_FIELD_TYPE (type, 1)));
 }
 
 /* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@@ -1384,7 +1502,7 @@
 {
   if (type == NULL)
     return 0;
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   return (TYPE_CODE (type) == TYPE_CODE_ARRAY
           || ada_is_array_descriptor_type (type));
 }
@@ -1396,7 +1514,7 @@
 {
   if (type == NULL)
     return 0;
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   return (TYPE_CODE (type) == TYPE_CODE_ARRAY
           || (TYPE_CODE (type) == TYPE_CODE_PTR
               && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY));
@@ -1411,7 +1529,7 @@
 
   if (type == NULL)
     return 0;
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   return
     data_type != NULL
     && ((TYPE_CODE (data_type) == TYPE_CODE_PTR
@@ -1456,7 +1574,7 @@
 
   if (!bounds)
     return
-      ada_check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr))));
+      check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr))));
   else
     {
       struct type *elt_type;
@@ -1468,7 +1586,7 @@
       arity = ada_array_arity (VALUE_TYPE (arr));
 
       if (elt_type == NULL || arity == 0)
-        return ada_check_typedef (VALUE_TYPE (arr));
+        return check_typedef (VALUE_TYPE (arr));
 
       descriptor = desc_bounds (arr);
       if (value_as_long (descriptor) == 0)
@@ -1556,7 +1674,7 @@
   if (type == NULL)
     return 0;
   type = desc_base_type (type);
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   return
     ada_type_name (type) != NULL
     && strstr (ada_type_name (type), "___XP") != NULL;
@@ -1578,12 +1696,12 @@
   struct type *new_type;
   LONGEST low_bound, high_bound;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
     return type;
 
   new_type = alloc_type (TYPE_OBJFILE (type));
-  new_elt_type = packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
+  new_elt_type = packed_array_type (check_typedef (TYPE_TARGET_TYPE (type)),
                                     elt_bits);
   create_array_type (new_type, new_elt_type, TYPE_FIELD_TYPE (type, 0));
   TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
@@ -1612,7 +1730,7 @@
 {
   struct symbol *sym;
   struct block **blocks;
-  const char *raw_name = ada_type_name (ada_check_typedef (type));
+  const char *raw_name = ada_type_name (check_typedef (type));
   char *name = (char *) alloca (strlen (raw_name) + 1);
   char *tail = strstr (raw_name, "___XP");
   struct type *shadow_type;
@@ -1627,21 +1745,22 @@
   sym = standard_lookup (name, get_selected_block (0), VAR_DOMAIN);
   if (sym == NULL || SYMBOL_TYPE (sym) == NULL)
     {
-      lim_warning ("could not find bounds information on packed array");
+      lim_warning ("could not find bounds information on packed array", 0);
       return NULL;
     }
   shadow_type = SYMBOL_TYPE (sym);
 
   if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
     {
-      lim_warning ("could not understand bounds information on packed array");
+      lim_warning ("could not understand bounds information on packed array",
+                   0);
       return NULL;
     }
 
   if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
     {
       lim_warning
-	("could not understand bit size information on packed array");
+        ("could not understand bit size information on packed array", 0);
       return NULL;
     }
 
@@ -1669,31 +1788,6 @@
       error ("can't unpack array");
       return NULL;
     }
-
-  if (BITS_BIG_ENDIAN && ada_is_modular_type (VALUE_TYPE (arr)))
-    {
-       /* This is a (right-justified) modular type representing a packed
- 	 array with no wrapper.  In order to interpret the value through
- 	 the (left-justified) packed array type we just built, we must
- 	 first left-justify it.  */
-      int bit_size, bit_pos;
-      ULONGEST mod;
-
-      mod = ada_modulus (VALUE_TYPE (arr)) - 1;
-      bit_size = 0;
-      while (mod > 0)
-	{
-	  bit_size += 1;
-	  mod >>= 1;
-	}
-      bit_pos = HOST_CHAR_BIT * TYPE_LENGTH (VALUE_TYPE (arr)) - bit_size;
-      arr = ada_value_primitive_packed_val (arr, NULL,
-					    bit_pos / HOST_CHAR_BIT,
-					    bit_pos % HOST_CHAR_BIT,
-					    bit_size,
-					    type);
-    }
-
   return coerce_unspec_val_to_type (arr, type);
 }
 
@@ -1712,7 +1806,7 @@
 
   bits = 0;
   elt_total_bit_offset = 0;
-  elt_type = ada_check_typedef (VALUE_TYPE (arr));
+  elt_type = check_typedef (VALUE_TYPE (arr));
   for (i = 0; i < arity; i += 1)
     {
       if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY
@@ -1727,7 +1821,7 @@
 
           if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
             {
-              lim_warning ("don't know bounds of array");
+              lim_warning ("don't know bounds of array", 0);
               lowerbound = upperbound = 0;
             }
 
@@ -1736,7 +1830,7 @@
             lim_warning ("packed array index %ld out of bounds", (long) idx);
           bits = TYPE_FIELD_BITSIZE (elt_type, 0);
           elt_total_bit_offset += (idx - lowerbound) * bits;
-          elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type));
+          elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
         }
     }
   elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
@@ -1799,7 +1893,7 @@
      the indices move.  */
   int delta = BITS_BIG_ENDIAN ? -1 : 1;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   if (obj == NULL)
     {
@@ -2057,7 +2151,7 @@
 
   elt = ada_coerce_to_simple_array (arr);
 
-  elt_type = ada_check_typedef (VALUE_TYPE (elt));
+  elt_type = check_typedef (VALUE_TYPE (elt));
   if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY
       && TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
     return value_subscript_packed (elt, arity, ind);
@@ -2154,7 +2248,7 @@
     while (TYPE_CODE (type) == TYPE_CODE_ARRAY)
       {
         arity += 1;
-        type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+        type = check_typedef (TYPE_TARGET_TYPE (type));
       }
 
   return arity;
@@ -2187,7 +2281,7 @@
       p_array_type = TYPE_TARGET_TYPE (p_array_type);
       while (k > 0 && p_array_type != NULL)
         {
-          p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type));
+          p_array_type = check_typedef (TYPE_TARGET_TYPE (p_array_type));
           k -= 1;
         }
       return p_array_type;
@@ -2334,7 +2428,7 @@
 struct value *
 ada_array_length (struct value *arr, int n)
 {
-  struct type *arr_type = ada_check_typedef (VALUE_TYPE (arr));
+  struct type *arr_type = check_typedef (VALUE_TYPE (arr));
 
   if (ada_is_packed_array_type (arr_type))
     return ada_array_length (decode_packed_array (arr), n);
@@ -2782,8 +2876,8 @@
 static int
 ada_type_match (struct type *ftype, struct type *atype, int may_deref)
 {
-  ftype = ada_check_typedef (ftype);
-  atype = ada_check_typedef (atype);
+  CHECK_TYPEDEF (ftype);
+  CHECK_TYPEDEF (atype);
 
   if (TYPE_CODE (ftype) == TYPE_CODE_REF)
     ftype = TYPE_TARGET_TYPE (ftype);
@@ -2862,8 +2956,8 @@
         return 0;
       else
         {
-          struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type, i));
-          struct type *atype = ada_check_typedef (VALUE_TYPE (actuals[i]));
+          struct type *ftype = check_typedef (TYPE_FIELD_TYPE (func_type, i));
+          struct type *atype = check_typedef (VALUE_TYPE (actuals[i]));
 
           if (!ada_type_match (ftype, atype, 1))
             return 0;
@@ -2936,7 +3030,7 @@
     {
       for (k = 0; k < nsyms; k += 1)
         {
-          struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].sym));
+          struct type *type = check_typedef (SYMBOL_TYPE (syms[k].sym));
 
           if (ada_args_match (syms[k].sym, args, nargs)
               && return_match (type, return_type))
@@ -3335,9 +3429,9 @@
 possible_user_operator_p (enum exp_opcode op, struct value *args[])
 {
   struct type *type0 =
-    (args[0] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[0]));
+    (args[0] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[0]));
   struct type *type1 =
-    (args[1] == NULL) ? NULL : ada_check_typedef (VALUE_TYPE (args[1]));
+    (args[1] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[1]));
 
   if (type0 == NULL)
     return 0;
@@ -3468,7 +3562,7 @@
 {
   if (! VALUE_LVAL (val))
     {
-      int len = TYPE_LENGTH (ada_check_typedef (VALUE_TYPE (val)));
+      int len = TYPE_LENGTH (check_typedef (VALUE_TYPE (val)));
 
       /* The following is taken from the structure-return code in
 	 call_function_by_hand. FIXME: Therefore, some refactoring seems 
@@ -3509,14 +3603,14 @@
 convert_actual (struct value *actual, struct type *formal_type0,
                 CORE_ADDR *sp)
 {
-  struct type *actual_type = ada_check_typedef (VALUE_TYPE (actual));
-  struct type *formal_type = ada_check_typedef (formal_type0);
+  struct type *actual_type = check_typedef (VALUE_TYPE (actual));
+  struct type *formal_type = check_typedef (formal_type0);
   struct type *formal_target =
     TYPE_CODE (formal_type) == TYPE_CODE_PTR
-    ? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
+    ? check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
   struct type *actual_target =
     TYPE_CODE (actual_type) == TYPE_CODE_PTR
-    ? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
+    ? check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
 
   if (ada_is_array_descriptor_type (formal_target)
       && TYPE_CODE (actual_target) == TYPE_CODE_ARRAY)
@@ -3531,7 +3625,7 @@
           if (VALUE_LVAL (actual) != lval_memory)
             {
               struct value *val;
-              actual_type = ada_check_typedef (VALUE_TYPE (actual));
+              actual_type = check_typedef (VALUE_TYPE (actual));
               val = allocate_value (actual_type);
               memcpy ((char *) VALUE_CONTENTS_RAW (val),
                       (char *) VALUE_CONTENTS (actual),
@@ -3563,7 +3657,7 @@
   struct value *bounds = allocate_value (bounds_type);
   int i;
 
-  for (i = ada_array_arity (ada_check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1)
+  for (i = ada_array_arity (check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1)
     {
       modify_general_field (VALUE_CONTENTS (bounds),
                             value_as_long (ada_array_bound (arr, i, 0)),
@@ -3619,9 +3713,107 @@
       convert_actual (args[i], TYPE_FIELD_TYPE (VALUE_TYPE (func), i), sp);
 }
 
-/* Dummy definitions for an experimental caching module that is not
- * used in the public sources. */
+                                /* Experimental Symbol Cache Module */
 
+/* This module may well have been OBE, due to improvements in the 
+   symbol-table module.  So until proven otherwise, it is disabled in
+   the submitted public code, and may be removed from all sources
+   in the future. */
+
+#ifdef GNAT_GDB
+
+/* This section implements a simple, fixed-sized hash table for those
+   Ada-mode symbols that get looked up in the course of executing the user's
+   commands.  The size is fixed on the grounds that there are not
+   likely to be all that many symbols looked up during any given
+   session, regardless of the size of the symbol table.  If we decide
+   to go to a resizable table, let's just use the stuff from libiberty
+   instead.  */
+
+#define HASH_SIZE 1009
+
+struct cache_entry
+{
+  const char *name;
+  domain_enum namespace;
+  struct symbol *sym;
+  struct symtab *symtab;
+  struct block *block;
+  struct cache_entry *next;
+};
+
+static struct obstack cache_space;
+
+static struct cache_entry *cache[HASH_SIZE];
+
+/* Clear all entries from the symbol cache.  */
+
+void
+clear_ada_sym_cache (void)
+{
+  obstack_free (&cache_space, NULL);
+  obstack_init (&cache_space);
+  memset (cache, '\000', sizeof (cache));
+}
+
+static struct cache_entry **
+find_entry (const char *name, domain_enum namespace)
+{
+  int h = msymbol_hash (name) % HASH_SIZE;
+  struct cache_entry **e;
+  for (e = &cache[h]; *e != NULL; e = &(*e)->next)
+    {
+      if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
+        return e;
+    }
+  return NULL;
+}
+
+/* Return (in SYM) the last cached definition for global or static symbol NAME
+   in namespace DOMAIN.  Returns 1 if entry found, 0 otherwise.
+   If SYMTAB is non-NULL, store the symbol
+   table in which the symbol was found there, or NULL if not found.
+   *BLOCK is set to the block in which NAME is found.  */
+
+static int
+lookup_cached_symbol (const char *name, domain_enum namespace,
+                      struct symbol **sym, struct block **block,
+                      struct symtab **symtab)
+{
+  struct cache_entry **e = find_entry (name, namespace);
+  if (e == NULL)
+    return 0;
+  if (sym != NULL)
+    *sym = (*e)->sym;
+  if (block != NULL)
+    *block = (*e)->block;
+  if (symtab != NULL)
+    *symtab = (*e)->symtab;
+  return 1;
+}
+
+/* Set the cached definition of NAME in DOMAIN to SYM in block
+   BLOCK and symbol table SYMTAB.  */
+
+static void
+cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+              struct block *block, struct symtab *symtab)
+{
+  int h = msymbol_hash (name) % HASH_SIZE;
+  char *copy;
+  struct cache_entry *e =
+    (struct cache_entry *) obstack_alloc (&cache_space, sizeof (*e));
+  e->next = cache[h];
+  cache[h] = e;
+  e->name = copy = obstack_alloc (&cache_space, strlen (name) + 1);
+  strcpy (copy, name);
+  e->sym = sym;
+  e->namespace = namespace;
+  e->symtab = symtab;
+  e->block = block;
+}
+
+#else
 static int
 lookup_cached_symbol (const char *name, domain_enum namespace,
                       struct symbol **sym, struct block **block,
@@ -3635,6 +3827,7 @@
               struct block *block, struct symtab *symtab)
 {
 }
+#endif /* GNAT_GDB */
 
                                 /* Symbol Lookup */
 
@@ -3744,7 +3937,7 @@
   struct ada_symbol_info *prevDefns = defns_collected (obstackp, 0);
 
   if (SYMBOL_TYPE (sym) != NULL)
-    SYMBOL_TYPE (sym) = ada_check_typedef (SYMBOL_TYPE (sym));
+    CHECK_TYPEDEF (SYMBOL_TYPE (sym));
   for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1)
     {
       if (lesseq_defined_than (sym, prevDefns[i].sym))
@@ -4016,6 +4209,16 @@
   return NULL;
 }
 
+/* Return up minimal symbol for NAME, folded and encoded according to 
+   Ada conventions, or NULL if none.  The last two arguments are ignored.  */
+
+static struct minimal_symbol *
+ada_lookup_minimal_symbol (const char *name, const char *sfile,
+                           struct objfile *objf)
+{
+  return ada_lookup_simple_minsym (ada_encode (name));
+}
+
 /* For all subprograms that statically enclose the subprogram of the
    selected frame, add symbols matching identifier NAME in DOMAIN
    and their blocks to the list of data in OBSTACKP, as for
@@ -4027,6 +4230,72 @@
                                   const char *name, domain_enum namespace,
                                   int wild_match)
 {
+#ifdef HAVE_ADD_SYMBOLS_FROM_ENCLOSING_PROCS
+  /* Use a heuristic to find the frames of enclosing subprograms: treat the
+     pointer-sized value at location 0 from the local-variable base of a
+     frame as a static link, and then search up the call stack for a
+     frame with that same local-variable base.  */
+  static struct symbol static_link_sym;
+  static struct symbol *static_link;
+  struct value *target_link_val;
+
+  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+  struct frame_info *frame;
+
+  if (!target_has_stack)
+    return;
+
+  if (static_link == NULL)
+    {
+      /* Initialize the local variable symbol that stands for the
+         static link (when there is one).  */
+      static_link = &static_link_sym;
+      SYMBOL_LINKAGE_NAME (static_link) = "";
+      SYMBOL_LANGUAGE (static_link) = language_unknown;
+      SYMBOL_CLASS (static_link) = LOC_LOCAL;
+      SYMBOL_DOMAIN (static_link) = VAR_DOMAIN;
+      SYMBOL_TYPE (static_link) = lookup_pointer_type (builtin_type_void);
+      SYMBOL_VALUE (static_link) =
+        -(long) TYPE_LENGTH (SYMBOL_TYPE (static_link));
+    }
+
+  frame = get_selected_frame ();
+  if (frame == NULL || inside_main_func (get_frame_address_in_block (frame)))
+    return;
+
+  target_link_val = read_var_value (static_link, frame);
+  while (target_link_val != NULL
+         && num_defns_collected (obstackp) == 0
+         && frame_relative_level (frame) <= MAX_ENCLOSING_FRAME_LEVELS)
+    {
+      CORE_ADDR target_link = value_as_address (target_link_val);
+
+      frame = get_prev_frame (frame);
+      if (frame == NULL)
+        break;
+
+      if (get_frame_locals_address (frame) == target_link)
+        {
+          struct block *block;
+
+          QUIT;
+
+          block = get_frame_block (frame, 0);
+          while (block != NULL && block_function (block) != NULL
+                 && num_defns_collected (obstackp) == 0)
+            {
+              QUIT;
+
+              ada_add_block_symbols (obstackp, block, name, namespace,
+                                     NULL, NULL, wild_match);
+
+              block = BLOCK_SUPERBLOCK (block);
+            }
+        }
+    }
+
+  do_cleanups (old_chain);
+#endif
 }
 
 /* FIXME: The next two routines belong in symtab.c */
@@ -4485,10 +4754,11 @@
 /* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
    scope and in global scopes, or NULL if none.  NAME is folded and
    encoded first.  Otherwise, the result is as for ada_lookup_symbol_list,
-   choosing the first symbol if there are multiple choices.  
-   *IS_A_FIELD_OF_THIS is set to 0 and *SYMTAB is set to the symbol
-   table in which the symbol was found (in both cases, these
-   assignments occur only if the pointers are non-null).  */
+   but is disambiguated by user query if needed.  *IS_A_FIELD_OF_THIS is
+   set to 0 and *SYMTAB is set to the symbol table in which the symbol
+   was found (in both cases, these assignments occur only if the
+   pointers are non-null).  */
+
 
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
@@ -4503,6 +4773,8 @@
 
   if (n_candidates == 0)
     return NULL;
+  else if (n_candidates != 1)
+    user_select_syms (candidates, n_candidates, 1);
 
   if (is_a_field_of_this != NULL)
     *is_a_field_of_this = 0;
@@ -4557,7 +4829,7 @@
    (__[0-9]+)?\.[0-9]+  [nested subprogram suffix, on platforms such 
                          as GNU/Linux]
    ___[0-9]+            [nested subprogram suffix, on platforms such as HP/UX]
-   (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(JM|LJM|X([FDBUP].*|R[^T]?)))?$
+   (X[nb]*)?((\$|__)[0-9](_?[0-9]+)|___(LJM|X([FDBUP].*|R[^T]?)))?$
  */
 
 static int
@@ -4620,13 +4892,6 @@
         return 0;
       if (str[2] == '_')
         {
-          if (strcmp (str + 3, "JM") == 0)
-            return 1;
-          /* FIXME: brobecker/2004-09-30: GNAT will soon stop using
-             the LJM suffix in favor of the JM one.  But we will
-             still accept LJM as a valid suffix for a reasonable
-             amount of time, just to allow ourselves to debug programs
-             compiled using an older version of GNAT.  */
           if (strcmp (str + 3, "LJM") == 0)
             return 1;
           if (str[3] != 'X')
@@ -4913,6 +5178,7 @@
                   }
               }
           }
+      end_loop2:;
       }
 
       /* NOTE: This really shouldn't be needed for _ada_ symbols.
@@ -4926,6 +5192,1388 @@
     }
 }
 
+#ifdef GNAT_GDB
+
+                                /* Symbol Completion */
+
+/* If SYM_NAME is a completion candidate for TEXT, return this symbol
+   name in a form that's appropriate for the completion.  The result
+   does not need to be deallocated, but is only good until the next call.
+
+   TEXT_LEN is equal to the length of TEXT.
+   Perform a wild match if WILD_MATCH is set.
+   ENCODED should be set if TEXT represents the start of a symbol name
+   in its encoded form.  */
+
+static const char *
+symbol_completion_match (const char *sym_name,
+                         const char *text, int text_len,
+                         int wild_match, int encoded)
+{
+  char *result;
+  const int verbatim_match = (text[0] == '<');
+  int match = 0;
+
+  if (verbatim_match)
+    {
+      /* Strip the leading angle bracket.  */
+      text = text + 1;
+      text_len--;
+    }
+
+  /* First, test against the fully qualified name of the symbol.  */
+
+  if (strncmp (sym_name, text, text_len) == 0)
+    match = 1;
+
+  if (match && !encoded)
+    {
+      /* One needed check before declaring a positive match is to verify
+         that iff we are doing a verbatim match, the decoded version
+         of the symbol name starts with '<'.  Otherwise, this symbol name
+         is not a suitable completion.  */
+      const char *sym_name_copy = sym_name;
+      int has_angle_bracket;
+
+      sym_name = ada_decode (sym_name);
+      has_angle_bracket = (sym_name[0] == '<');
+      match = (has_angle_bracket == verbatim_match);
+      sym_name = sym_name_copy;
+    }
+
+  if (match && !verbatim_match)
+    {
+      /* When doing non-verbatim match, another check that needs to
+         be done is to verify that the potentially matching symbol name
+         does not include capital letters, because the ada-mode would
+         not be able to understand these symbol names without the
+         angle bracket notation.  */
+      const char *tmp;
+
+      for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
+      if (*tmp != '\0')
+        match = 0;
+    }
+
+  /* Second: Try wild matching...  */
+
+  if (!match && wild_match)
+    {
+      /* Since we are doing wild matching, this means that TEXT
+         may represent an unqualified symbol name.  We therefore must
+         also compare TEXT against the unqualified name of the symbol.  */
+      sym_name = ada_unqualified_name (ada_decode (sym_name));
+
+      if (strncmp (sym_name, text, text_len) == 0)
+        match = 1;
+    }
+
+  /* Finally: If we found a mach, prepare the result to return.  */
+
+  if (!match)
+    return NULL;
+
+  if (verbatim_match)
+    sym_name = add_angle_brackets (sym_name);
+
+  if (!encoded)
+    sym_name = ada_decode (sym_name);
+
+  return sym_name;
+}
+
+/* A companion function to ada_make_symbol_completion_list().
+   Check if SYM_NAME represents a symbol which name would be suitable
+   to complete TEXT (TEXT_LEN is the length of TEXT), in which case
+   it is appended at the end of the given string vector SV.
+
+   ORIG_TEXT is the string original string from the user command
+   that needs to be completed.  WORD is the entire command on which
+   completion should be performed.  These two parameters are used to
+   determine which part of the symbol name should be added to the
+   completion vector.
+   if WILD_MATCH is set, then wild matching is performed.
+   ENCODED should be set if TEXT represents a symbol name in its
+   encoded formed (in which case the completion should also be
+   encoded).  */
+
+static void
+symbol_completion_add (struct string_vector *sv,
+                       const char *sym_name,
+                       const char *text, int text_len,
+                       const char *orig_text, const char *word,
+                       int wild_match, int encoded)
+{
+  const char *match = symbol_completion_match (sym_name, text, text_len,
+                                               wild_match, encoded);
+  char *completion;
+
+  if (match == NULL)
+    return;
+
+  /* We found a match, so add the appropriate completion to the given
+     string vector.  */
+
+  if (word == orig_text)
+    {
+      completion = xmalloc (strlen (match) + 5);
+      strcpy (completion, match);
+    }
+  else if (word > orig_text)
+    {
+      /* Return some portion of sym_name.  */
+      completion = xmalloc (strlen (match) + 5);
+      strcpy (completion, match + (word - orig_text));
+    }
+  else
+    {
+      /* Return some of ORIG_TEXT plus sym_name.  */
+      completion = xmalloc (strlen (match) + (orig_text - word) + 5);
+      strncpy (completion, word, orig_text - word);
+      completion[orig_text - word] = '\0';
+      strcat (completion, match);
+    }
+
+  string_vector_append (sv, completion);
+}
+
+/* Return a list of possible symbol names completing TEXT0.  The list
+   is NULL terminated.  WORD is the entire command on which completion
+   is made.  */
+
+char **
+ada_make_symbol_completion_list (const char *text0, const char *word)
+{
+  /* Note: This function is almost a copy of make_symbol_completion_list(),
+     except it has been adapted for Ada.  It is somewhat of a shame to
+     duplicate so much code, but we don't really have the infrastructure
+     yet to develop a language-aware version of he symbol completer...  */
+  char *text;
+  int text_len;
+  int wild_match;
+  int encoded;
+  struct string_vector result = xnew_string_vector (128);
+  struct symbol *sym;
+  struct symtab *s;
+  struct partial_symtab *ps;
+  struct minimal_symbol *msymbol;
+  struct objfile *objfile;
+  struct block *b, *surrounding_static_block = 0;
+  int i;
+  struct dict_iterator iter;
+
+  if (text0[0] == '<')
+    {
+      text = xstrdup (text0);
+      make_cleanup (xfree, text);
+      text_len = strlen (text);
+      wild_match = 0;
+      encoded = 1;
+    }
+  else
+    {
+      text = xstrdup (ada_encode (text0));
+      make_cleanup (xfree, text);
+      text_len = strlen (text);
+      for (i = 0; i < text_len; i++)
+        text[i] = tolower (text[i]);
+
+      /* FIXME: brobecker/2003-09-17: When we get rid of ADA_RETAIN_DOTS,
+         we can restrict the wild_match check to searching "__" only.  */
+      wild_match = (strstr (text0, "__") == NULL
+                    && strchr (text0, '.') == NULL);
+      encoded = (strstr (text0, "__") != NULL);
+    }
+
+  /* First, look at the partial symtab symbols.  */
+  ALL_PSYMTABS (objfile, ps)
+  {
+    struct partial_symbol **psym;
+
+    /* If the psymtab's been read in we'll get it when we search
+       through the blockvector.  */
+    if (ps->readin)
+      continue;
+
+    for (psym = objfile->global_psymbols.list + ps->globals_offset;
+         psym < (objfile->global_psymbols.list + ps->globals_offset
+                 + ps->n_global_syms); psym++)
+      {
+        QUIT;
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
+
+    for (psym = objfile->static_psymbols.list + ps->statics_offset;
+         psym < (objfile->static_psymbols.list + ps->statics_offset
+                 + ps->n_static_syms); psym++)
+      {
+        QUIT;
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
+  }
+
+  /* At this point scan through the misc symbol vectors and add each
+     symbol you find to the list.  Eventually we want to ignore
+     anything that isn't a text symbol (everything else will be
+     handled by the psymtab code above).  */
+
+  ALL_MSYMBOLS (objfile, msymbol)
+  {
+    QUIT;
+    symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (msymbol),
+                           text, text_len, text0, word, wild_match, encoded);
+  }
+
+  /* Search upwards from currently selected frame (so that we can
+     complete on local vars.  */
+
+  for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+    {
+      if (!BLOCK_SUPERBLOCK (b))
+        surrounding_static_block = b;   /* For elmin of dups */
+
+      ALL_BLOCK_SYMBOLS (b, iter, sym)
+      {
+        symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                               text, text_len, text0, word,
+                               wild_match, encoded);
+      }
+    }
+
+  /* Go through the symtabs and check the externs and statics for
+     symbols which match.  */
+
+  ALL_SYMTABS (objfile, s)
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+    ALL_BLOCK_SYMBOLS (b, iter, sym)
+    {
+      symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                             text, text_len, text0, word,
+                             wild_match, encoded);
+    }
+  }
+
+  ALL_SYMTABS (objfile, s)
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+    /* Don't do this block twice.  */
+    if (b == surrounding_static_block)
+      continue;
+    ALL_BLOCK_SYMBOLS (b, iter, sym)
+    {
+      symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+                             text, text_len, text0, word,
+                             wild_match, encoded);
+    }
+  }
+
+  /* Append the closing NULL entry.  */
+  string_vector_append (&result, NULL);
+
+  return (result.array);
+}
+
+#endif /* GNAT_GDB */
+
+#ifdef GNAT_GDB
+                                /* Breakpoint-related */
+
+/* Assuming that LINE is pointing at the beginning of an argument to
+   'break', return a pointer to the delimiter for the initial segment
+   of that name.  This is the first ':', ' ', or end of LINE.  */
+
+char *
+ada_start_decode_line_1 (char *line)
+{
+  /* NOTE: strpbrk would be more elegant, but I am reluctant to be
+     the first to use such a library function in GDB code.  */
+  char *p;
+  for (p = line; *p != '\000' && *p != ' ' && *p != ':'; p += 1)
+    ;
+  return p;
+}
+
+/* *SPEC points to a function and line number spec (as in a break
+   command), following any initial file name specification.
+
+   Return all symbol table/line specfications (sals) consistent with the
+   information in *SPEC and FILE_TABLE in the following sense:
+     + FILE_TABLE is null, or the sal refers to a line in the file
+       named by FILE_TABLE.
+     + If *SPEC points to an argument with a trailing ':LINENUM',
+       then the sal refers to that line (or one following it as closely as
+       possible).
+     + If *SPEC does not start with '*', the sal is in a function with
+       that name.
+
+   Returns with 0 elements if no matching non-minimal symbols found.
+
+   If *SPEC begins with a function name of the form <NAME>, then NAME
+   is taken as a literal name; otherwise the function name is subject
+   to the usual encoding.
+
+   *SPEC is updated to point after the function/line number specification.
+
+   FUNFIRSTLINE is non-zero if we desire the first line of real code
+   in each function.
+
+   If CANONICAL is non-NULL, and if any of the sals require a
+   'canonical line spec', then *CANONICAL is set to point to an array
+   of strings, corresponding to and equal in length to the returned
+   list of sals, such that (*CANONICAL)[i] is non-null and contains a
+   canonical line spec for the ith returned sal, if needed.  If no
+   canonical line specs are required and CANONICAL is non-null,
+   *CANONICAL is set to NULL.
+
+   A 'canonical line spec' is simply a name (in the format of the
+   breakpoint command) that uniquely identifies a breakpoint position,
+   with no further contextual information or user selection.  It is
+   needed whenever the file name, function name, and line number
+   information supplied is insufficient for this unique
+   identification.  Currently overloaded functions, the name '*',
+   or static functions without a filename yield a canonical line spec.
+   The array and the line spec strings are allocated on the heap; it
+   is the caller's responsibility to free them.  */
+
+struct symtabs_and_lines
+ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
+                          int funfirstline, char ***canonical)
+{
+  struct ada_symbol_info *symbols;
+  const struct block *block;
+  int n_matches, i, line_num;
+  struct symtabs_and_lines selected;
+  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+  char *name;
+  int is_quoted;
+
+  int len;
+  char *lower_name;
+  char *unquoted_name;
+
+  if (file_table == NULL)
+    block = block_static_block (get_selected_block (0));
+  else
+    block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_table), STATIC_BLOCK);
+
+  if (canonical != NULL)
+    *canonical = (char **) NULL;
+
+  is_quoted = (**spec && strchr (get_gdb_completer_quote_characters (),
+                                 **spec) != NULL);
+
+  name = *spec;
+  if (**spec == '*')
+    *spec += 1;
+  else
+    {
+      if (is_quoted)
+        *spec = skip_quoted (*spec);
+      while (**spec != '\000'
+             && !strchr (ada_completer_word_break_characters, **spec))
+        *spec += 1;
+    }
+  len = *spec - name;
+
+  line_num = -1;
+  if (file_table != NULL && (*spec)[0] == ':' && isdigit ((*spec)[1]))
+    {
+      line_num = strtol (*spec + 1, spec, 10);
+      while (**spec == ' ' || **spec == '\t')
+        *spec += 1;
+    }
+
+  if (name[0] == '*')
+    {
+      if (line_num == -1)
+        error ("Wild-card function with no line number or file name.");
+
+      return ada_sals_for_line (file_table->filename, line_num,
+                                funfirstline, canonical, 0);
+    }
+
+  if (name[0] == '\'')
+    {
+      name += 1;
+      len -= 2;
+    }
+
+  if (name[0] == '<')
+    {
+      unquoted_name = (char *) alloca (len - 1);
+      memcpy (unquoted_name, name + 1, len - 2);
+      unquoted_name[len - 2] = '\000';
+      lower_name = NULL;
+    }
+  else
+    {
+      unquoted_name = (char *) alloca (len + 1);
+      memcpy (unquoted_name, name, len);
+      unquoted_name[len] = '\000';
+      lower_name = (char *) alloca (len + 1);
+      for (i = 0; i < len; i += 1)
+        lower_name[i] = tolower (name[i]);
+      lower_name[len] = '\000';
+    }
+
+  n_matches = 0;
+  if (lower_name != NULL)
+    n_matches = ada_lookup_symbol_list (ada_encode (lower_name), block,
+                                        VAR_DOMAIN, &symbols);
+  if (n_matches == 0)
+    n_matches = ada_lookup_symbol_list (unquoted_name, block,
+                                        VAR_DOMAIN, &symbols);
+  if (n_matches == 0 && line_num >= 0)
+    error ("No line number information found for %s.", unquoted_name);
+  else if (n_matches == 0)
+    {
+#ifdef HPPA_COMPILER_BUG
+      /* FIXME: See comment in symtab.c::decode_line_1 */
+#undef volatile
+      volatile struct symtab_and_line val;
+#define volatile                /*nothing */
+#else
+      struct symtab_and_line val;
+#endif
+      struct minimal_symbol *msymbol;
+
+      init_sal (&val);
+
+      msymbol = NULL;
+      if (lower_name != NULL)
+        msymbol = ada_lookup_simple_minsym (ada_encode (lower_name));
+      if (msymbol == NULL)
+        msymbol = ada_lookup_simple_minsym (unquoted_name);
+      if (msymbol != NULL)
+        {
+          val.pc = SYMBOL_VALUE_ADDRESS (msymbol);
+          val.section = SYMBOL_BFD_SECTION (msymbol);
+          if (funfirstline)
+            {
+              val.pc = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+							   val.pc,
+							   &current_target);
+              SKIP_PROLOGUE (val.pc);
+            }
+          selected.sals = (struct symtab_and_line *)
+            xmalloc (sizeof (struct symtab_and_line));
+          selected.sals[0] = val;
+          selected.nelts = 1;
+          return selected;
+        }
+
+      if (!have_full_symbols ()
+          && !have_partial_symbols () && !have_minimal_symbols ())
+        error ("No symbol table is loaded.  Use the \"file\" command.");
+
+      error ("Function \"%s\" not defined.", unquoted_name);
+      return selected;          /* for lint */
+    }
+
+  if (line_num >= 0)
+    {
+      struct symtabs_and_lines best_sal =
+        find_sal_from_funcs_and_line (file_table->filename, line_num,
+                                      symbols, n_matches);
+      if (funfirstline)
+        adjust_pc_past_prologue (&best_sal.sals[0].pc);
+      return best_sal;
+    }
+  else
+    {
+      selected.nelts = user_select_syms (symbols, n_matches, n_matches);
+    }
+
+  selected.sals = (struct symtab_and_line *)
+    xmalloc (sizeof (struct symtab_and_line) * selected.nelts);
+  memset (selected.sals, 0, selected.nelts * sizeof (selected.sals[i]));
+  make_cleanup (xfree, selected.sals);
+
+  i = 0;
+  while (i < selected.nelts)
+    {
+      if (SYMBOL_CLASS (symbols[i].sym) == LOC_BLOCK)
+        selected.sals[i]
+          = find_function_start_sal (symbols[i].sym, funfirstline);
+      else if (SYMBOL_LINE (symbols[i].sym) != 0)
+        {
+          selected.sals[i].symtab =
+            symbols[i].symtab
+            ? symbols[i].symtab : symtab_for_sym (symbols[i].sym);
+          selected.sals[i].line = SYMBOL_LINE (symbols[i].sym);
+        }
+      else if (line_num >= 0)
+        {
+          /* Ignore this choice */
+          symbols[i] = symbols[selected.nelts - 1];
+          selected.nelts -= 1;
+          continue;
+        }
+      else
+        error ("Line number not known for symbol \"%s\"", unquoted_name);
+      i += 1;
+    }
+
+  if (canonical != NULL && (line_num >= 0 || n_matches > 1))
+    {
+      *canonical = (char **) xmalloc (sizeof (char *) * selected.nelts);
+      for (i = 0; i < selected.nelts; i += 1)
+        (*canonical)[i] =
+          extended_canonical_line_spec (selected.sals[i],
+                                        SYMBOL_PRINT_NAME (symbols[i].sym));
+    }
+
+  discard_cleanups (old_chain);
+  return selected;
+}
+
+/* The (single) sal corresponding to line LINE_NUM in a symbol table
+   with file name FILENAME that occurs in one of the functions listed
+   in the symbol fields of SYMBOLS[0 .. NSYMS-1].  */
+
+static struct symtabs_and_lines
+find_sal_from_funcs_and_line (const char *filename, int line_num,
+                              struct ada_symbol_info *symbols, int nsyms)
+{
+  struct symtabs_and_lines sals;
+  int best_index, best;
+  struct linetable *best_linetable;
+  struct objfile *objfile;
+  struct symtab *s;
+  struct symtab *best_symtab;
+
+  read_all_symtabs (filename);
+
+  best_index = 0;
+  best_linetable = NULL;
+  best_symtab = NULL;
+  best = 0;
+  ALL_SYMTABS (objfile, s)
+  {
+    struct linetable *l;
+    int ind, exact;
+
+    QUIT;
+
+    if (strcmp (filename, s->filename) != 0)
+      continue;
+    l = LINETABLE (s);
+    ind = find_line_in_linetable (l, line_num, symbols, nsyms, &exact);
+    if (ind >= 0)
+      {
+        if (exact)
+          {
+            best_index = ind;
+            best_linetable = l;
+            best_symtab = s;
+            goto done;
+          }
+        if (best == 0 || l->item[ind].line < best)
+          {
+            best = l->item[ind].line;
+            best_index = ind;
+            best_linetable = l;
+            best_symtab = s;
+          }
+      }
+  }
+
+  if (best == 0)
+    error ("Line number not found in designated function.");
+
+done:
+
+  sals.nelts = 1;
+  sals.sals = (struct symtab_and_line *) xmalloc (sizeof (sals.sals[0]));
+
+  init_sal (&sals.sals[0]);
+
+  sals.sals[0].line = best_linetable->item[best_index].line;
+  sals.sals[0].pc = best_linetable->item[best_index].pc;
+  sals.sals[0].symtab = best_symtab;
+
+  return sals;
+}
+
+/* Return the index in LINETABLE of the best match for LINE_NUM whose
+   pc falls within one of the functions denoted by the symbol fields
+   of SYMBOLS[0..NSYMS-1].  Set *EXACTP to 1 if the match is exact, 
+   and 0 otherwise.  */
+
+static int
+find_line_in_linetable (struct linetable *linetable, int line_num,
+                        struct ada_symbol_info *symbols, int nsyms,
+                        int *exactp)
+{
+  int i, len, best_index, best;
+
+  if (line_num <= 0 || linetable == NULL)
+    return -1;
+
+  len = linetable->nitems;
+  for (i = 0, best_index = -1, best = 0; i < len; i += 1)
+    {
+      int k;
+      struct linetable_entry *item = &(linetable->item[i]);
+
+      for (k = 0; k < nsyms; k += 1)
+        {
+          if (symbols[k].sym != NULL
+              && SYMBOL_CLASS (symbols[k].sym) == LOC_BLOCK
+              && item->pc >= BLOCK_START (SYMBOL_BLOCK_VALUE (symbols[k].sym))
+              && item->pc < BLOCK_END (SYMBOL_BLOCK_VALUE (symbols[k].sym)))
+            goto candidate;
+        }
+      continue;
+
+    candidate:
+
+      if (item->line == line_num)
+        {
+          *exactp = 1;
+          return i;
+        }
+
+      if (item->line > line_num && (best == 0 || item->line < best))
+        {
+          best = item->line;
+          best_index = i;
+        }
+    }
+
+  *exactp = 0;
+  return best_index;
+}
+
+/* Find the smallest k >= LINE_NUM such that k is a line number in
+   LINETABLE, and k falls strictly within a named function that begins at
+   or before LINE_NUM.  Return -1 if there is no such k.  */
+
+static int
+nearest_line_number_in_linetable (struct linetable *linetable, int line_num)
+{
+  int i, len, best;
+
+  if (line_num <= 0 || linetable == NULL || linetable->nitems == 0)
+    return -1;
+  len = linetable->nitems;
+
+  i = 0;
+  best = INT_MAX;
+  while (i < len)
+    {
+      struct linetable_entry *item = &(linetable->item[i]);
+
+      if (item->line >= line_num && item->line < best)
+        {
+          char *func_name;
+          CORE_ADDR start, end;
+
+          func_name = NULL;
+          find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+          if (func_name != NULL && item->pc < end)
+            {
+              if (item->line == line_num)
+                return line_num;
+              else
+                {
+                  struct symbol *sym =
+                    standard_lookup (func_name, NULL, VAR_DOMAIN);
+                  if (is_plausible_func_for_line (sym, line_num))
+                    best = item->line;
+                  else
+                    {
+                      do
+                        i += 1;
+                      while (i < len && linetable->item[i].pc < end);
+                      continue;
+                    }
+                }
+            }
+        }
+
+      i += 1;
+    }
+
+  return (best == INT_MAX) ? -1 : best;
+}
+
+
+/* Return the next higher index, k, into LINETABLE such that k > IND,
+   entry k in LINETABLE has a line number equal to LINE_NUM, k
+   corresponds to a PC that is in a function different from that
+   corresponding to IND, and falls strictly within a named function
+   that begins at a line at or preceding STARTING_LINE.
+   Return -1 if there is no such k.
+   IND == -1 corresponds to no function.  */
+
+static int
+find_next_line_in_linetable (struct linetable *linetable, int line_num,
+                             int starting_line, int ind)
+{
+  int i, len;
+
+  if (line_num <= 0 || linetable == NULL || ind >= linetable->nitems)
+    return -1;
+  len = linetable->nitems;
+
+  if (ind >= 0)
+    {
+      CORE_ADDR start, end;
+
+      if (find_pc_partial_function (linetable->item[ind].pc,
+                                    (char **) NULL, &start, &end))
+        {
+          while (ind < len && linetable->item[ind].pc < end)
+            ind += 1;
+        }
+      else
+        ind += 1;
+    }
+  else
+    ind = 0;
+
+  i = ind;
+  while (i < len)
+    {
+      struct linetable_entry *item = &(linetable->item[i]);
+
+      if (item->line >= line_num)
+        {
+          char *func_name;
+          CORE_ADDR start, end;
+
+          func_name = NULL;
+          find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+          if (func_name != NULL && item->pc < end)
+            {
+              if (item->line == line_num)
+                {
+                  struct symbol *sym =
+                    standard_lookup (func_name, NULL, VAR_DOMAIN);
+                  if (is_plausible_func_for_line (sym, starting_line))
+                    return i;
+                  else
+                    {
+                      while ((i + 1) < len && linetable->item[i + 1].pc < end)
+                        i += 1;
+                    }
+                }
+            }
+        }
+      i += 1;
+    }
+
+  return -1;
+}
+
+/* True iff function symbol SYM starts somewhere at or before line #
+   LINE_NUM.  */
+
+static int
+is_plausible_func_for_line (struct symbol *sym, int line_num)
+{
+  struct symtab_and_line start_sal;
+
+  if (sym == NULL)
+    return 0;
+
+  start_sal = find_function_start_sal (sym, 0);
+
+  return (start_sal.line != 0 && line_num >= start_sal.line);
+}
+
+/* Read in all symbol tables corresponding to partial symbol tables
+   with file name FILENAME.  */
+
+static void
+read_all_symtabs (const char *filename)
+{
+  struct partial_symtab *ps;
+  struct objfile *objfile;
+
+  ALL_PSYMTABS (objfile, ps)
+  {
+    QUIT;
+
+    if (strcmp (filename, ps->filename) == 0)
+      PSYMTAB_TO_SYMTAB (ps);
+  }
+}
+
+/* All sals corresponding to line LINE_NUM in a symbol table from file
+   FILENAME, as filtered by the user.  Filter out any lines that
+   reside in functions with "suppressed" names (not corresponding to
+   explicit Ada functions), if there is at least one in a function
+   with a non-suppressed name.  If CANONICAL is not null, set
+   it to a corresponding array of canonical line specs.
+   If ONE_LOCATION_ONLY is set and several matches are found for
+   the given location, then automatically select the first match found
+   instead of asking the user which instance should be returned.  */
+
+struct symtabs_and_lines
+ada_sals_for_line (const char *filename, int line_num,
+                   int funfirstline, char ***canonical, int one_location_only)
+{
+  struct symtabs_and_lines result;
+  struct objfile *objfile;
+  struct symtab *s;
+  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+  size_t len;
+
+  read_all_symtabs (filename);
+
+  result.sals =
+    (struct symtab_and_line *) xmalloc (4 * sizeof (result.sals[0]));
+  result.nelts = 0;
+  len = 4;
+  make_cleanup (free_current_contents, &result.sals);
+
+  ALL_SYMTABS (objfile, s)
+  {
+    int ind, target_line_num;
+
+    QUIT;
+
+    if (strcmp (s->filename, filename) != 0)
+      continue;
+
+    target_line_num =
+      nearest_line_number_in_linetable (LINETABLE (s), line_num);
+    if (target_line_num == -1)
+      continue;
+
+    ind = -1;
+    while (1)
+      {
+        ind =
+          find_next_line_in_linetable (LINETABLE (s),
+                                       target_line_num, line_num, ind);
+
+        if (ind < 0)
+          break;
+
+        GROW_VECT (result.sals, len, result.nelts + 1);
+        init_sal (&result.sals[result.nelts]);
+        result.sals[result.nelts].line = line_num;
+        result.sals[result.nelts].pc = LINETABLE (s)->item[ind].pc;
+        result.sals[result.nelts].symtab = s;
+
+        if (funfirstline)
+          adjust_pc_past_prologue (&result.sals[result.nelts].pc);
+
+        result.nelts += 1;
+      }
+  }
+
+  if (canonical != NULL || result.nelts > 1)
+    {
+      int k, j, n;
+      char **func_names = (char **) alloca (result.nelts * sizeof (char *));
+      int first_choice = (result.nelts > 1) ? 2 : 1;
+      int *choices = (int *) alloca (result.nelts * sizeof (int));
+
+      for (k = 0; k < result.nelts; k += 1)
+        {
+          find_pc_partial_function (result.sals[k].pc, &func_names[k],
+                                    (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
+          if (func_names[k] == NULL)
+            error ("Could not find function for one or more breakpoints.");
+        }
+
+      /* Remove suppressed names, unless all are suppressed.  */
+      for (j = 0; j < result.nelts; j += 1)
+        if (!is_suppressed_name (func_names[j]))
+          {
+            /* At least one name is unsuppressed, so remove all
+               suppressed names.  */
+            for (k = n = 0; k < result.nelts; k += 1)
+              if (!is_suppressed_name (func_names[k]))
+                {
+                  func_names[n] = func_names[k];
+                  result.sals[n] = result.sals[k];
+                  n += 1;
+                }
+            result.nelts = n;
+            break;
+          }
+
+      if (result.nelts > 1)
+        {
+          if (one_location_only)
+            {
+              /* Automatically select the first of all possible choices.  */
+              n = 1;
+              choices[0] = 0;
+            }
+          else
+            {
+              printf_unfiltered ("[0] cancel\n");
+              if (result.nelts > 1)
+                printf_unfiltered ("[1] all\n");
+              for (k = 0; k < result.nelts; k += 1)
+                printf_unfiltered ("[%d] %s\n", k + first_choice,
+                                   ada_decode (func_names[k]));
+
+              n = get_selections (choices, result.nelts, result.nelts,
+                                  result.nelts > 1, "instance-choice");
+            }
+
+          for (k = 0; k < n; k += 1)
+            {
+              result.sals[k] = result.sals[choices[k]];
+              func_names[k] = func_names[choices[k]];
+            }
+          result.nelts = n;
+        }
+
+      if (canonical != NULL && result.nelts == 0)
+        *canonical = NULL;
+      else if (canonical != NULL)
+        {
+          *canonical = (char **) xmalloc (result.nelts * sizeof (char **));
+          make_cleanup (xfree, *canonical);
+          for (k = 0; k < result.nelts; k += 1)
+            {
+              (*canonical)[k] =
+                extended_canonical_line_spec (result.sals[k], func_names[k]);
+              if ((*canonical)[k] == NULL)
+                error ("Could not locate one or more breakpoints.");
+              make_cleanup (xfree, (*canonical)[k]);
+            }
+        }
+    }
+
+  if (result.nelts == 0)
+    {
+      do_cleanups (old_chain);
+      result.sals = NULL;
+    }
+  else
+    discard_cleanups (old_chain);
+  return result;
+}
+
+
+/* A canonical line specification of the form FILE:NAME:LINENUM for
+   symbol table and line data SAL.  NULL if insufficient
+   information.  The caller is responsible for releasing any space
+   allocated.  */
+
+static char *
+extended_canonical_line_spec (struct symtab_and_line sal, const char *name)
+{
+  char *r;
+
+  if (sal.symtab == NULL || sal.symtab->filename == NULL || sal.line <= 0)
+    return NULL;
+
+  r = (char *) xmalloc (strlen (name) + strlen (sal.symtab->filename)
+                        + sizeof (sal.line) * 3 + 3);
+  sprintf (r, "%s:'%s':%d", sal.symtab->filename, name, sal.line);
+  return r;
+}
+
+
+				/* Exception-related */
+
+int
+ada_is_exception_sym (struct symbol *sym)
+{
+  char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+          && SYMBOL_CLASS (sym) != LOC_BLOCK
+          && SYMBOL_CLASS (sym) != LOC_CONST
+          && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
+/* Return type of Ada breakpoint associated with bp_stat:
+   0 if not an Ada-specific breakpoint, 1 for break on specific exception,
+   2 for break on unhandled exception, 3 for assert.  */
+
+static int
+ada_exception_breakpoint_type (bpstat bs)
+{
+  return ((!bs || !bs->breakpoint_at) ? 0
+          : bs->breakpoint_at->break_on_exception);
+}
+
+/* True iff FRAME is very likely to be that of a function that is
+   part of the runtime system.  This is all very heuristic, but is
+   intended to be used as advice as to what frames are uninteresting
+   to most users.  */
+
+static int
+is_known_support_routine (struct frame_info *frame)
+{
+  struct frame_info *next_frame = get_next_frame (frame);
+  /* If frame is not innermost, that normally means that frame->pc
+     points to *after* the call instruction, and we want to get the line
+     containing the call, never the next line.  But if the next frame is
+     a signal_handler_caller or a dummy frame, then the next frame was
+     not entered as the result of a call, and we want to get the line
+     containing frame->pc.  */
+  const int pc_is_after_call =
+    next_frame != NULL
+    && get_frame_type (next_frame) != SIGTRAMP_FRAME
+    && get_frame_type (next_frame) != DUMMY_FRAME;
+  struct symtab_and_line sal
+    = find_pc_line (get_frame_pc (frame), pc_is_after_call);
+  char *func_name;
+  int i;
+  struct stat st;
+
+  /* The heuristic:
+     1. The symtab is null (indicating no debugging symbols)
+     2. The symtab's filename does not exist.
+     3. The object file's name is one of the standard libraries.
+     4. The symtab's file name has the form of an Ada library source file.
+     5. The function at frame's PC has a GNAT-compiler-generated name.  */
+
+  if (sal.symtab == NULL)
+    return 1;
+
+  /* On some systems (e.g. VxWorks), the kernel contains debugging
+     symbols; in this case, the filename referenced by these symbols
+     does not exists.  */
+
+  if (stat (sal.symtab->filename, &st))
+    return 1;
+
+  for (i = 0; known_runtime_file_name_patterns[i] != NULL; i += 1)
+    {
+      re_comp (known_runtime_file_name_patterns[i]);
+      if (re_exec (sal.symtab->filename))
+        return 1;
+    }
+  if (sal.symtab->objfile != NULL)
+    {
+      for (i = 0; known_runtime_file_name_patterns[i] != NULL; i += 1)
+        {
+          re_comp (known_runtime_file_name_patterns[i]);
+          if (re_exec (sal.symtab->objfile->name))
+            return 1;
+        }
+    }
+
+  /* If the frame PC points after the call instruction, then we need to
+     decrement it in order to search for the function associated to this
+     PC.  Otherwise, if the associated call was the last instruction of
+     the function, we might either find the wrong function or even fail
+     during the function name lookup.  */
+  if (pc_is_after_call)
+    func_name = function_name_from_pc (get_frame_pc (frame) - 1);
+  else
+    func_name = function_name_from_pc (get_frame_pc (frame));
+
+  if (func_name == NULL)
+    return 1;
+
+  for (i = 0; known_auxiliary_function_name_patterns[i] != NULL; i += 1)
+    {
+      re_comp (known_auxiliary_function_name_patterns[i]);
+      if (re_exec (func_name))
+        return 1;
+    }
+
+  return 0;
+}
+
+/* Find the first frame that contains debugging information and that is not
+   part of the Ada run-time, starting from FI and moving upward.  */
+
+void
+ada_find_printable_frame (struct frame_info *fi)
+{
+  for (; fi != NULL; fi = get_prev_frame (fi))
+    {
+      if (!is_known_support_routine (fi))
+        {
+          select_frame (fi);
+          break;
+        }
+    }
+
+}
+
+/* Name found for exception associated with last bpstat sent to
+   ada_adjust_exception_stop.  Set to the null string if that bpstat
+   did not correspond to an Ada exception or no name could be found.  */
+
+static char last_exception_name[256];
+
+/* If BS indicates a stop in an Ada exception, try to go up to a frame
+   that will be meaningful to the user, and save the name of the last
+   exception (truncated, if necessary) in last_exception_name.  */
+
+void
+ada_adjust_exception_stop (bpstat bs)
+{
+  CORE_ADDR addr;
+  struct frame_info *fi;
+  int frame_level;
+  char *selected_frame_func;
+
+  addr = 0;
+  last_exception_name[0] = '\0';
+  fi = get_selected_frame ();
+  selected_frame_func = function_name_from_pc (get_frame_pc (fi));
+
+  switch (ada_exception_breakpoint_type (bs))
+    {
+    default:
+      return;
+    case 1:
+      break;
+    case 2:
+      /* Unhandled exceptions.  Select the frame corresponding to
+         ada.exceptions.process_raise_exception.  This frame is at
+         least 2 levels up, so we simply skip the first 2 frames
+         without checking the name of their associated function.  */
+      for (frame_level = 0; frame_level < 2; frame_level += 1)
+        if (fi != NULL)
+          fi = get_prev_frame (fi);
+      while (fi != NULL)
+        {
+          const char *func_name = function_name_from_pc (get_frame_pc (fi));
+          if (func_name != NULL
+              && strcmp (func_name, process_raise_exception_name) == 0)
+            break;              /* We found the frame we were looking for...  */
+          fi = get_prev_frame (fi);
+        }
+      if (fi == NULL)
+        break;
+      select_frame (fi);
+      break;
+    }
+
+  addr = parse_and_eval_address ("e.full_name");
+
+  if (addr != 0)
+    read_memory (addr, last_exception_name, sizeof (last_exception_name) - 1);
+  last_exception_name[sizeof (last_exception_name) - 1] = '\0';
+  ada_find_printable_frame (get_selected_frame ());
+}
+
+/* Output Ada exception name (if any) associated with last call to
+   ada_adjust_exception_stop.  */
+
+void
+ada_print_exception_stop (bpstat bs)
+{
+  if (last_exception_name[0] != '\000')
+    {
+      ui_out_text (uiout, last_exception_name);
+      ui_out_text (uiout, " at ");
+    }
+}
+
+/* Parses the CONDITION string associated with a breakpoint exception
+   to get the name of the exception on which the breakpoint has been
+   set.  The returned string needs to be deallocated after use.  */
+
+static char *
+exception_name_from_cond (const char *condition)
+{
+  char *start, *end, *exception_name;
+  int exception_name_len;
+
+  start = strrchr (condition, '&') + 1;
+  end = strchr (start, ')') - 1;
+  exception_name_len = end - start + 1;
+
+  exception_name =
+    (char *) xmalloc ((exception_name_len + 1) * sizeof (char));
+  sprintf (exception_name, "%.*s", exception_name_len, start);
+
+  return exception_name;
+}
+
+/* Print Ada-specific exception information about B, other than task
+   clause.  Return non-zero iff B was an Ada exception breakpoint.  */
+
+int
+ada_print_exception_breakpoint_nontask (struct breakpoint *b)
+{
+  if (b->break_on_exception == 1)
+    {
+      if (b->cond_string)       /* the breakpoint is on a specific exception.  */
+        {
+          char *exception_name = exception_name_from_cond (b->cond_string);
+
+          make_cleanup (xfree, exception_name);
+
+          ui_out_text (uiout, "on ");
+          if (ui_out_is_mi_like_p (uiout))
+            ui_out_field_string (uiout, "exception", exception_name);
+          else
+            {
+              ui_out_text (uiout, "exception ");
+              ui_out_text (uiout, exception_name);
+              ui_out_text (uiout, " ");
+            }
+        }
+      else
+        ui_out_text (uiout, "on all exceptions");
+    }
+  else if (b->break_on_exception == 2)
+    ui_out_text (uiout, "on unhandled exception");
+  else if (b->break_on_exception == 3)
+    ui_out_text (uiout, "on assert failure");
+  else
+    return 0;
+  return 1;
+}
+
+/* Print task identifier for breakpoint B, if it is an Ada-specific
+   breakpoint with non-zero tasking information.  */
+
+void
+ada_print_exception_breakpoint_task (struct breakpoint *b)
+{
+  if (b->task != 0)
+    {
+      ui_out_text (uiout, " task ");
+      ui_out_field_int (uiout, "task", b->task);
+    }
+}
+
+/* Cause the appropriate error if no appropriate runtime symbol is
+   found to set a breakpoint, using ERR_DESC to describe the
+   breakpoint.  */
+
+static void
+error_breakpoint_runtime_sym_not_found (const char *err_desc)
+{
+  /* If we are not debugging an Ada program, we can not put exception
+     breakpoints!  */
+
+  if (ada_update_initial_language (language_unknown, NULL) != language_ada)
+    error ("Unable to break on %s.  Is this an Ada main program?", err_desc);
+
+  /* If the symbol does not exist, then check that the program is
+     already started, to make sure that shared libraries have been
+     loaded.  If it is not started, this may mean that the symbol is
+     in a shared library.  */
+
+  if (ptid_get_pid (inferior_ptid) == 0)
+    error ("Unable to break on %s. Try to start the program first.",
+           err_desc);
+
+  /* At this point, we know that we are debugging an Ada program and
+     that the inferior has been started, but we still are not able to
+     find the run-time symbols. That can mean that we are in
+     configurable run time mode, or that a-except as been optimized
+     out by the linker...  In any case, at this point it is not worth
+     supporting this feature.  */
+
+  error ("Cannot break on %s in this configuration.", err_desc);
+}
+
+/* Test if NAME is currently defined, and that either ALLOW_TRAMP or
+   the symbol is not a shared-library trampoline.  Return the result of
+   the test.  */
+
+static int
+is_runtime_sym_defined (const char *name, int allow_tramp)
+{
+  struct minimal_symbol *msym;
+
+  msym = lookup_minimal_symbol (name, NULL, NULL);
+  return (msym != NULL && msym->type != mst_unknown
+          && (allow_tramp || msym->type != mst_solib_trampoline));
+}
+
+/* If ARG points to an Ada exception or assert breakpoint, rewrite
+   into equivalent form.  Return resulting argument string.  Set
+   *BREAK_ON_EXCEPTIONP to 1 for ordinary break on exception, 2 for
+   break on unhandled, 3 for assert, 0 otherwise.  */
+
+char *
+ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
+{
+  if (arg == NULL)
+    return arg;
+  *break_on_exceptionp = 0;
+  if (current_language->la_language == language_ada
+      && strncmp (arg, "exception", 9) == 0
+      && (arg[9] == ' ' || arg[9] == '\t' || arg[9] == '\0'))
+    {
+      char *tok, *end_tok;
+      int toklen;
+      int has_exception_propagation =
+        is_runtime_sym_defined (raise_sym_name, 1);
+
+      *break_on_exceptionp = 1;
+
+      tok = arg + 9;
+      while (*tok == ' ' || *tok == '\t')
+        tok += 1;
+
+      end_tok = tok;
+
+      while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
+        end_tok += 1;
+
+      toklen = end_tok - tok;
+
+      arg = (char *) xmalloc (sizeof (longest_exception_template) + toklen);
+      make_cleanup (xfree, arg);
+      if (toklen == 0)
+        {
+          if (has_exception_propagation)
+            sprintf (arg, "'%s'", raise_sym_name);
+          else
+            error_breakpoint_runtime_sym_not_found ("exception");
+        }
+      else if (strncmp (tok, "unhandled", toklen) == 0)
+        {
+          if (is_runtime_sym_defined (raise_unhandled_sym_name, 1))
+            sprintf (arg, "'%s'", raise_unhandled_sym_name);
+          else
+            error_breakpoint_runtime_sym_not_found ("exception");
+
+          *break_on_exceptionp = 2;
+        }
+      else
+        {
+          if (is_runtime_sym_defined (raise_sym_name, 0))
+            sprintf (arg, "'%s' if long_integer(e) = long_integer(&%.*s)",
+                     raise_sym_name, toklen, tok);
+          else
+            error_breakpoint_runtime_sym_not_found ("specific exception");
+        }
+    }
+  else if (current_language->la_language == language_ada
+           && strncmp (arg, "assert", 6) == 0
+           && (arg[6] == ' ' || arg[6] == '\t' || arg[6] == '\0'))
+    {
+      char *tok = arg + 6;
+
+      if (!is_runtime_sym_defined (raise_assert_sym_name, 1))
+        error_breakpoint_runtime_sym_not_found ("failed assertion");
+
+      *break_on_exceptionp = 3;
+
+      arg =
+        (char *) xmalloc (sizeof (raise_assert_sym_name) + strlen (tok) + 2);
+      make_cleanup (xfree, arg);
+      sprintf (arg, "'%s'%s", raise_assert_sym_name, tok);
+    }
+  return arg;
+}
+#endif /* GNAT_GDB */
+
                                 /* Field Access */
 
 /* True if field number FIELD_NUM in struct or union type TYPE is supposed
@@ -5069,14 +6717,14 @@
 {
   int i;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
     return NULL;
 
   for (i = 0; i < TYPE_NFIELDS (type); i += 1)
     if (ada_is_parent_field (type, i))
-      return ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+      return check_typedef (TYPE_FIELD_TYPE (type, i));
 
   return NULL;
 }
@@ -5088,7 +6736,7 @@
 int
 ada_is_parent_field (struct type *type, int field_num)
 {
-  const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num);
+  const char *name = TYPE_FIELD_NAME (check_typedef (type), field_num);
   return (name != NULL
           && (strncmp (name, "PARENT", 6) == 0
               || strncmp (name, "_parent", 7) == 0));
@@ -5305,7 +6953,7 @@
 {
   struct type *type;
 
-  arg_type = ada_check_typedef (arg_type);
+  CHECK_TYPEDEF (arg_type);
   type = TYPE_FIELD_TYPE (arg_type, fieldno);
 
   /* Handle packed fields.  */
@@ -5337,7 +6985,7 @@
 {
   int i;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   *field_type_p = NULL;
   *byte_offset_p = *bit_offset_p = *bit_size_p = 0;
 
@@ -5369,7 +7017,7 @@
       else if (ada_is_variant_part (type, i))
         {
           int j;
-          struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+          struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
 
           for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
             {
@@ -5398,7 +7046,7 @@
                          struct type *type)
 {
   int i;
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   for (i = TYPE_NFIELDS (type) - 1; i >= 0; i -= 1)
     {
@@ -5423,7 +7071,7 @@
       else if (ada_is_variant_part (type, i))
         {
           int j;
-          struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+          struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
           int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
 
           for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
@@ -5464,7 +7112,7 @@
   struct value *v;
 
   v = NULL;
-  t1 = t = ada_check_typedef (VALUE_TYPE (arg));
+  t1 = t = check_typedef (VALUE_TYPE (arg));
   if (TYPE_CODE (t) == TYPE_CODE_REF)
     {
       t1 = TYPE_TARGET_TYPE (t);
@@ -5475,7 +7123,7 @@
           else
             error ("Bad value type in a %s.", err);
         }
-      t1 = ada_check_typedef (t1);
+      CHECK_TYPEDEF (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
         {
           COERCE_REF (arg);
@@ -5493,7 +7141,7 @@
           else
             error ("Bad value type in a %s.", err);
         }
-      t1 = ada_check_typedef (t1);
+      CHECK_TYPEDEF (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
         {
           arg = value_ind (arg);
@@ -5532,10 +7180,7 @@
         {
           if (bit_size != 0)
             {
-              if (TYPE_CODE (t) == TYPE_CODE_REF)
-                arg = ada_coerce_ref (arg);
-              else
-                arg = ada_value_ind (arg);
+              arg = ada_value_ind (arg);
               v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
                                                   bit_offset, bit_size,
                                                   field_type);
@@ -5581,7 +7226,7 @@
   if (refok && type != NULL)
     while (1)
       {
-        type = ada_check_typedef (type);
+        CHECK_TYPEDEF (type);
         if (TYPE_CODE (type) != TYPE_CODE_PTR
             && TYPE_CODE (type) != TYPE_CODE_REF)
           break;
@@ -5622,7 +7267,7 @@
         {
           if (dispp != NULL)
             *dispp += TYPE_FIELD_BITPOS (type, i) / 8;
-          return ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+          return check_typedef (TYPE_FIELD_TYPE (type, i));
         }
 
       else if (ada_is_wrapper_field (type, i))
@@ -5641,7 +7286,7 @@
       else if (ada_is_variant_part (type, i))
         {
           int j;
-          struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i));
+          struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
 
           for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
             {
@@ -5950,7 +7595,7 @@
 static struct type *
 dynamic_template_type (struct type *type)
 {
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT
       || ada_type_name (type) == NULL)
@@ -6159,23 +7804,7 @@
         }
     }
 
-  /* According to exp_dbug.ads, the size of TYPE for variable-size records
-     should contain the alignment of that record, which should be a strictly
-     positive value.  If null or negative, then something is wrong, most
-     probably in the debug info.  In that case, we don't round up the size
-     of the resulting type. If this record is not part of another structure,
-     the current RTYPE length might be good enough for our purposes.  */
-  if (TYPE_LENGTH (type) <= 0)
-    {
-      warning ("Invalid type size for `%s' detected: %d.",
-               TYPE_NAME (rtype) ? TYPE_NAME (rtype) : "<unnamed>",
-               TYPE_LENGTH (type));
-    }
-  else
-    {
-      TYPE_LENGTH (rtype) = align_value (TYPE_LENGTH (rtype),
-                                         TYPE_LENGTH (type));
-    }
+  TYPE_LENGTH (rtype) = align_value (TYPE_LENGTH (rtype), TYPE_LENGTH (type));
 
   value_free_to_mark (mark);
   if (TYPE_LENGTH (rtype) > varsize_limit)
@@ -6218,7 +7847,7 @@
 
   for (f = 0; f < nfields; f += 1)
     {
-      struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type0, f));
+      struct type *field_type = CHECK_TYPEDEF (TYPE_FIELD_TYPE (type0, f));
       struct type *new_type;
 
       if (is_dynamic_field (type0, f))
@@ -6424,7 +8053,7 @@
   index_type_desc = ada_find_parallel_type (type0, "___XA");
   if (index_type_desc == NULL)
     {
-      struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0));
+      struct type *elt_type0 = check_typedef (TYPE_TARGET_TYPE (type0));
       /* NOTE: elt_type---the fixed version of elt_type0---should never
          depend on the contents of the array in properly constructed
          debugging data.  */
@@ -6448,7 +8077,7 @@
       /* NOTE: result---the fixed version of elt_type0---should never
          depend on the contents of the array in properly constructed
          debugging data.  */
-      result = ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval);
+      result = ada_to_fixed_type (check_typedef (elt_type0), 0, 0, dval);
       for (i = TYPE_NFIELDS (index_type_desc) - 1; i >= 0; i -= 1)
         {
           struct type *range_type =
@@ -6476,7 +8105,7 @@
 ada_to_fixed_type (struct type *type, char *valaddr,
                    CORE_ADDR address, struct value *dval)
 {
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
     {
     default:
@@ -6519,7 +8148,7 @@
   if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
     return type0;
 
-  type0 = ada_check_typedef (type0);
+  CHECK_TYPEDEF (type0);
 
   switch (TYPE_CODE (type0))
     {
@@ -6547,7 +8176,7 @@
 {
   if (ada_is_aligner_type (type))
     {
-      struct type *type1 = TYPE_FIELD_TYPE (ada_check_typedef (type), 0);
+      struct type *type1 = TYPE_FIELD_TYPE (check_typedef (type), 0);
       if (ada_type_name (type1) == NULL)
         TYPE_NAME (type1) = ada_type_name (type);
 
@@ -6578,7 +8207,7 @@
    exists, otherwise TYPE.  */
 
 struct type *
-ada_check_typedef (struct type *type)
+ada_completed_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
@@ -6622,6 +8251,24 @@
                                     val);
 }
 
+/* If the PC is pointing inside a function prologue, then re-adjust it
+   past this prologue.  */
+
+static void
+adjust_pc_past_prologue (CORE_ADDR *pc)
+{
+  struct symbol *func_sym = find_pc_function (*pc);
+
+  if (func_sym)
+    {
+      const struct symtab_and_line sal =
+        find_function_start_sal (func_sym, 1);
+
+      if (*pc <= sal.pc)
+        *pc = sal.pc;
+    }
+}
+
 /* A value representing VAL, but with a standard (static-sized) type
    chosen to approximate the real type of VAL as well as possible, but
    without consulting any runtime values.  For Ada dynamic-sized
@@ -6749,7 +8396,7 @@
 int
 ada_is_string_type (struct type *type)
 {
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
   if (type != NULL
       && TYPE_CODE (type) != TYPE_CODE_PTR
       && (ada_is_simple_array_type (type)
@@ -6772,14 +8419,7 @@
 int
 ada_is_aligner_type (struct type *type)
 {
-  type = ada_check_typedef (type);
-
-  /* If we can find a parallel XVS type, then the XVS type should
-     be used instead of this type.  And hence, this is not an aligner
-     type.  */
-  if (ada_find_parallel_type (type, "___XVS") != NULL)
-    return 0;
-
+  CHECK_TYPEDEF (type);
   return (TYPE_CODE (type) == TYPE_CODE_STRUCT
           && TYPE_NFIELDS (type) == 1
           && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
@@ -6934,12 +8574,12 @@
 static struct value *
 unwrap_value (struct value *val)
 {
-  struct type *type = ada_check_typedef (VALUE_TYPE (val));
+  struct type *type = check_typedef (VALUE_TYPE (val));
   if (ada_is_aligner_type (type))
     {
       struct value *v = value_struct_elt (&val, NULL, "F",
                                           NULL, "internal structure");
-      struct type *val_type = ada_check_typedef (VALUE_TYPE (v));
+      struct type *val_type = check_typedef (VALUE_TYPE (v));
       if (ada_type_name (val_type) == NULL)
         TYPE_NAME (val_type) = ada_type_name (type);
 
@@ -6948,7 +8588,7 @@
   else
     {
       struct type *raw_real_type =
-        ada_check_typedef (ada_get_base_type (type));
+        ada_completed_type (ada_get_base_type (type));
 
       if (type == raw_real_type)
         return val;
@@ -7000,8 +8640,8 @@
   if (type == type2)
     return val;
 
-  type2 = ada_check_typedef (type2);
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type2);
+  CHECK_TYPEDEF (type);
 
   if (TYPE_CODE (type2) == TYPE_CODE_PTR
       && TYPE_CODE (type) == TYPE_CODE_ARRAY)
@@ -7031,8 +8671,8 @@
 
   COERCE_REF (arg1);
   COERCE_REF (arg2);
-  type1 = base_type (ada_check_typedef (VALUE_TYPE (arg1)));
-  type2 = base_type (ada_check_typedef (VALUE_TYPE (arg2)));
+  type1 = base_type (check_typedef (VALUE_TYPE (arg1)));
+  type2 = base_type (check_typedef (VALUE_TYPE (arg2)));
 
   if (TYPE_CODE (type1) != TYPE_CODE_INT
       || TYPE_CODE (type2) != TYPE_CODE_INT)
@@ -7143,7 +8783,7 @@
       arg1 = evaluate_subexp (type, exp, pos, noside);
       if (noside == EVAL_SKIP)
         goto nosideret;
-      if (type != ada_check_typedef (VALUE_TYPE (arg1)))
+      if (type != check_typedef (VALUE_TYPE (arg1)))
         {
           if (ada_is_fixed_point_type (type))
             arg1 = cast_to_fixed (type, arg1);
@@ -7320,20 +8960,20 @@
                    && VALUE_LVAL (argvec[0]) == lval_memory))
         argvec[0] = value_addr (argvec[0]);
 
-      type = ada_check_typedef (VALUE_TYPE (argvec[0]));
+      type = check_typedef (VALUE_TYPE (argvec[0]));
       if (TYPE_CODE (type) == TYPE_CODE_PTR)
         {
-          switch (TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type))))
+          switch (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (type))))
             {
             case TYPE_CODE_FUNC:
-              type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+              type = check_typedef (TYPE_TARGET_TYPE (type));
               break;
             case TYPE_CODE_ARRAY:
               break;
             case TYPE_CODE_STRUCT:
               if (noside != EVAL_AVOID_SIDE_EFFECTS)
                 argvec[0] = ada_value_ind (argvec[0]);
-              type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+              type = check_typedef (TYPE_TARGET_TYPE (type));
               break;
             default:
               error ("cannot subscript or call something of type `%s'",
@@ -7392,8 +9032,7 @@
                                                    nargs, argvec + 1));
 
         default:
-          error ("Attempt to index or call something other than an "
-		 "array or function");
+          error ("Internal error in evaluate_subexp");
         }
 
     case TERNOP_SLICE:
@@ -7401,15 +9040,9 @@
         struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
         struct value *low_bound_val =
           evaluate_subexp (NULL_TYPE, exp, pos, noside);
-        struct value *high_bound_val =
-          evaluate_subexp (NULL_TYPE, exp, pos, noside);
-        LONGEST low_bound;
-        LONGEST high_bound;
-        COERCE_REF (low_bound_val);
-        COERCE_REF (high_bound_val);
-        low_bound = pos_atr (low_bound_val);
-        high_bound = pos_atr (high_bound_val);
-
+        LONGEST low_bound = pos_atr (low_bound_val);
+        LONGEST high_bound
+          = pos_atr (evaluate_subexp (NULL_TYPE, exp, pos, noside));
         if (noside == EVAL_SKIP)
           goto nosideret;
 
@@ -7431,26 +9064,12 @@
           array = value_addr (array);
 
         if (noside == EVAL_AVOID_SIDE_EFFECTS
-            && ada_is_array_descriptor_type (ada_check_typedef
-                                             (VALUE_TYPE (array))))
+            && ada_is_array_descriptor_type (check_typedef
+					     (VALUE_TYPE (array))))
           return empty_array (ada_type_of_array (array, 0), low_bound);
 
         array = ada_coerce_to_simple_array_ptr (array);
 
-        /* If we have more than one level of pointer indirection,
-           dereference the value until we get only one level.  */
-        while (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR
-               && (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array)))
-                     == TYPE_CODE_PTR))
-          array = value_ind (array);
-
-        /* Make sure we really do have an array type before going further,
-           to avoid a SEGV when trying to get the index type or the target
-           type later down the road if the debug info generated by
-           the compiler is incorrect or incomplete.  */
-        if (!ada_is_simple_array_type (VALUE_TYPE (array)))
-          error ("cannot take slice of non-array");
-
         if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
           {
             if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -7486,7 +9105,7 @@
         {
         default:
           lim_warning ("Membership test incompletely implemented; "
-                       "always returns true");
+                       "always returns true", 0);
           return value_from_longest (builtin_type_int, (LONGEST) 1);
 
         case TYPE_CODE_RANGE:
@@ -7758,11 +9377,11 @@
 
     case UNOP_IND:
       if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
-        expect_type = TYPE_TARGET_TYPE (ada_check_typedef (expect_type));
+        expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
       arg1 = evaluate_subexp (expect_type, exp, pos, noside);
       if (noside == EVAL_SKIP)
         goto nosideret;
-      type = ada_check_typedef (VALUE_TYPE (arg1));
+      type = check_typedef (VALUE_TYPE (arg1));
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
         {
           if (ada_is_array_descriptor_type (type))
@@ -7777,13 +9396,11 @@
                    || TYPE_CODE (type) == TYPE_CODE_REF
                    /* In C you can dereference an array to get the 1st elt.  */
                    || TYPE_CODE (type) == TYPE_CODE_ARRAY)
-            {
-              type = to_static_fixed_type
-                (ada_aligned_type
-                 (ada_check_typedef (TYPE_TARGET_TYPE (type))));
-              check_size (type);
-              return value_zero (type, lval_memory);
-            }
+            return
+              value_zero
+              (to_static_fixed_type
+               (ada_aligned_type (check_typedef (TYPE_TARGET_TYPE (type)))),
+               lval_memory);
           else if (TYPE_CODE (type) == TYPE_CODE_INT)
             /* GDB allows dereferencing an int.  */
             return value_zero (builtin_type_int, lval_memory);
@@ -7791,7 +9408,7 @@
             error ("Attempt to take contents of a non-pointer value.");
         }
       arg1 = ada_coerce_ref (arg1);     /* FIXME: What is this for?? */
-      type = ada_check_typedef (VALUE_TYPE (arg1));
+      type = check_typedef (VALUE_TYPE (arg1));
 
       if (ada_is_array_descriptor_type (type))
         /* GDB allows dereferencing GNAT array descriptors.  */
@@ -8150,7 +9767,7 @@
           L = get_int_var_value (name_buf, &ok);
           if (!ok)
             {
-              lim_warning ("Unknown lower bound, using 1.");
+              lim_warning ("Unknown lower bound, using 1.", 1);
               L = 1;
             }
         }
@@ -8206,10 +9823,10 @@
 
 /* Assuming ada_is_modular_type (TYPE), the modulus of TYPE.  */
 
-ULONGEST
+LONGEST
 ada_modulus (struct type * type)
 {
-  return (ULONGEST) TYPE_HIGH_BOUND (type) + 1;
+  return TYPE_HIGH_BOUND (type) + 1;
 }
 
                                 /* Operators */
@@ -8644,10 +10261,10 @@
   lai->primitive_type_vector [ada_primitive_type_short] =
     init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
                0, "short_integer", (struct objfile *) NULL);
-  lai->string_char_type = 
-    lai->primitive_type_vector [ada_primitive_type_char] =
+  lai->primitive_type_vector [ada_primitive_type_char] =
     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
                0, "character", (struct objfile *) NULL);
+  lai->string_char_type = builtin->builtin_char;
   lai->primitive_type_vector [ada_primitive_type_float] =
     init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
                0, "float", (struct objfile *) NULL);
@@ -8708,6 +10325,10 @@
   type_check_off,
   case_sensitive_on,            /* Yes, Ada is case-insensitive, but
                                    that's not quite what this means.  */
+#ifdef GNAT_GDB
+  ada_lookup_symbol,
+  ada_lookup_minimal_symbol,
+#endif /* GNAT_GDB */
   array_row_major,
   &ada_exp_descriptor,
   parse,
@@ -8732,6 +10353,10 @@
   NULL,
   ada_get_gdb_completer_word_break_characters,
   ada_language_arch_info,
+#ifdef GNAT_GDB
+  ada_translate_error_message,  /* Substitute Ada-specific terminology
+                                   in errors and warnings.  */
+#endif /* GNAT_GDB */
   LANG_MAGIC
 };
 
@@ -8741,6 +10366,14 @@
   add_language (&ada_language_defn);
 
   varsize_limit = 65536;
+#ifdef GNAT_GDB
+  add_setshow_uinteger_cmd ("varsize-limit", class_support,
+			    &varsize_limit, "\
+Set the maximum number of bytes allowed in a dynamic-sized object.", "\
+Show the maximum number of bytes allowed in a dynamic-sized object.",
+			    NULL, NULL, &setlist, &showlist);
+  obstack_init (&cache_space);
+#endif /* GNAT_GDB */
 
   obstack_init (&symbol_list_obstack);
 
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 18a662a..931fd8e 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -367,7 +367,7 @@
 
 extern struct type *ada_get_base_type (struct type *);
 
-extern struct type *ada_check_typedef (struct type *);
+extern struct type *ada_completed_type (struct type *);
 
 extern char *ada_encode (const char *);
 
@@ -375,7 +375,7 @@
 
 extern int ada_is_modular_type (struct type *);
 
-extern ULONGEST ada_modulus (struct type *);
+extern LONGEST ada_modulus (struct type *);
 
 extern struct value *ada_value_ind (struct value *);
 
@@ -413,6 +413,10 @@
 
 extern void ada_print_exception_breakpoint_task (struct breakpoint *);
 
+extern int ada_maybe_exception_partial_symbol (struct partial_symbol *sym);
+
+extern int ada_is_exception_sym (struct symbol *sym);
+
 extern void ada_find_printable_frame (struct frame_info *fi);
 
 extern void ada_reset_thread_registers (void);
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 6aa3b7d..6ecd849 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -26,6 +26,9 @@
 /* each successive token and places a semantic value into yylval */
 /* (ada-lval), defined by the parser.   */
 
+/* Run flex with (at least) the -i option (case-insensitive), and the -I */
+/* option (interactive---no unnecessary lookahead).  */
+
 DIG	[0-9]
 NUM10	({DIG}({DIG}|_)*)
 HEXDIG	[0-9a-f]
@@ -42,6 +45,8 @@
 POSEXP  (e"+"?{NUM10})
 
 %{
+#define malloc xmalloc
+#define free xfree
 
 #define NUMERAL_WIDTH 256
 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
@@ -84,8 +89,6 @@
 
 %}
 
-%option case-insensitive interactive nodefault
-
 %s IN_STRING BEFORE_QUAL_QUOTE
 
 %%
@@ -154,6 +157,8 @@
 		   return CHARLIT;
 		}
 
+\"{OPER}\"/{WHITE}*"(" { return processId (yytext, yyleng); }
+
 <INITIAL>\"	{
 		   tempbuf_len = 0;
 		   BEGIN IN_STRING;
@@ -345,7 +350,7 @@
   if (tempbufsize < n)
     {
       tempbufsize = (n+63) & ~63;
-      tempbuf = xrealloc (tempbuf, tempbufsize);
+      tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
     }
 }
 
@@ -919,10 +924,3 @@
 {
   return 1;
 }
-
-/* Dummy definition to suppress warnings about unused static definitions. */
-typedef void (*dummy_function) ();
-dummy_function ada_flex_use[] = 
-{ 
-  (dummy_function) yyunput
-};
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 8311d63..5e3385c 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -754,7 +754,7 @@
 ada_print_type (struct type *type0, char *varstring, struct ui_file *stream,
 		int show, int level)
 {
-  struct type *type = ada_check_typedef (ada_get_base_type (type0));
+  struct type *type = ada_completed_type (ada_get_base_type (type0));
   char *type_name = decoded_type_name (type);
   int is_var_decl = (varstring != NULL && varstring[0] != '\0');
 
@@ -768,7 +768,7 @@
     }
 
   if (show > 0)
-    type = ada_check_typedef (type);
+    CHECK_TYPEDEF (type);
 
   if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC)
     fprintf_filtered (stream, "%.*s: ",
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 82e6825..3617d76 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -367,7 +367,7 @@
   unsigned int i;
   unsigned len;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   switch (TYPE_CODE (type))
     {
@@ -599,7 +599,7 @@
   LONGEST val;
   char *valaddr = valaddr0 + embedded_offset;
 
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   if (ada_is_array_descriptor_type (type) || ada_is_packed_array_type (type))
     {
@@ -960,7 +960,7 @@
 print_record (struct type *type, char *valaddr, struct ui_file *stream,
 	      int format, int recurse, enum val_prettyprint pretty)
 {
-  type = ada_check_typedef (type);
+  CHECK_TYPEDEF (type);
 
   fprintf_filtered (stream, "(");
 
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 63687d7..11a4471 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -105,8 +105,8 @@
 
 static struct target_ops aix_thread_ops;
 
-/* Copy of the target over which ops is pushed.  This is more
-   convenient than a pointer to deprecated_child_ops or core_ops,
+/* Copy of the target over which ops is pushed.  
+   This is more convenient than a pointer to child_ops or core_ops,
    because they lack current_target's default callbacks.  */
 
 static struct target_ops base_target;
@@ -1604,8 +1604,8 @@
   struct cleanup *cleanup = save_inferior_ptid ();
 
   inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
-  n = base_target.deprecated_xfer_memory (memaddr, myaddr, len, 
-					  write, attrib, &base_target);
+  n = base_target.to_xfer_memory (memaddr, myaddr, len, 
+				  write, attrib, &base_target);
   do_cleanups (cleanup);
 
   return n;
@@ -1736,7 +1736,7 @@
   aix_thread_ops.to_wait               = aix_thread_wait;
   aix_thread_ops.to_fetch_registers    = aix_thread_fetch_registers;
   aix_thread_ops.to_store_registers    = aix_thread_store_registers;
-  aix_thread_ops.deprecated_xfer_memory = aix_thread_xfer_memory;
+  aix_thread_ops.to_xfer_memory        = aix_thread_xfer_memory;
   /* No need for aix_thread_ops.to_create_inferior, because we activate thread
      debugging when the inferior reaches pd_brk_addr.  */
   aix_thread_ops.to_kill               = aix_thread_kill;
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index ad00f98..299ed3a 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -226,8 +226,6 @@
 {
   gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD_ELF,
                           alphanbsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD_ELF,
-                          alphanbsd_init_abi);
 
   deprecated_add_core_fns (&alphanbsd_core_fns);
   deprecated_add_core_fns (&alphanbsd_elfcore_fns);
diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h
index 0b8caf2..edf6df8 100644
--- a/gdb/amd64-nat.h
+++ b/gdb/amd64-nat.h
@@ -1,6 +1,6 @@
 /* Native-dependent code for AMD64.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -50,9 +50,4 @@
 extern void amd64_collect_native_gregset (const struct regcache *regcache,
 					  void *gregs, int regnum);
 
-/* Create a prototype *BSD/amd64 target.  The client can override it
-   with local methods.  */
-
-extern struct target_ops *amd64bsd_target (void);
-
 #endif /* amd64-nat.h */
diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c
index 4393553..b30885a 100644
--- a/gdb/amd64bsd-nat.c
+++ b/gdb/amd64bsd-nat.c
@@ -22,7 +22,6 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
-#include "target.h"
 
 /* We include <signal.h> to make sure `struct fxsave64' is defined on
    NetBSD, since NetBSD's <machine/reg.h> needs it.  */
@@ -34,14 +33,13 @@
 
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
-#include "inf-ptrace.h"
 
 
 /* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
    for all registers (including the floating-point registers).  */
 
-static void
-amd64bsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
 {
   if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
     {
@@ -71,8 +69,8 @@
 /* Store register REGNUM back into the inferior.  If REGNUM is -1, do
    this for all registers (including the floating-point registers).  */
 
-static void
-amd64bsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
 {
   if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
     {
@@ -107,17 +105,3 @@
 	perror_with_name ("Couldn't write floating point status");
     }
 }
-
-/* Create a prototype *BSD/amd64 target.  The client can override it
-   with local methods.  */
-
-struct target_ops *
-amd64bsd_target (void)
-{
-  struct target_ops *t;
-
-  t = inf_ptrace_target ();
-  t->to_fetch_registers = amd64bsd_fetch_inferior_registers;
-  t->to_store_registers = amd64bsd_store_inferior_registers;
-  return t;
-}
diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index b778761..caeaee9 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -22,7 +22,6 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
-#include "target.h"
 
 #include "gdb_assert.h"
 #include <signal.h>
@@ -32,7 +31,6 @@
 #include <sys/sysctl.h>
 #include <machine/reg.h>
 
-#include "fbsd-nat.h"
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
 
@@ -140,22 +138,11 @@
 void
 _initialize_amd64fbsd_nat (void)
 {
-  struct target_ops *t;
   int offset;
 
   amd64_native_gregset32_reg_offset = amd64fbsd32_r_reg_offset;
   amd64_native_gregset64_reg_offset = amd64fbsd64_r_reg_offset;
 
-  /* Add some extra features to the common *BSD/i386 target.  */
-  t = amd64bsd_target ();
-  t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
-  t->to_find_memory_regions = fbsd_find_memory_regions;
-  t->to_make_corefile_notes = fbsd_make_corefile_notes;
-  add_target (t);
-
-  /* Support debugging kernel virtual memory images.  */
-  bsd_kvm_add_target (amd64fbsd_supply_pcb);
-
   /* To support the recognition of signal handlers, i386bsd-tdep.c
      hardcodes some constants.  Inclusion of this file means that we
      are compiling a native debugger, which means that we can use the
@@ -232,4 +219,7 @@
 	amd64fbsd_sigtramp_end_addr = ps_strings;
       }
   }
+
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (amd64fbsd_supply_pcb);
 }
diff --git a/gdb/amd64nbsd-nat.c b/gdb/amd64nbsd-nat.c
index 911f99e..df7ceb9 100644
--- a/gdb/amd64nbsd-nat.c
+++ b/gdb/amd64nbsd-nat.c
@@ -20,7 +20,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "target.h"
 
 #include "gdb_assert.h"
 
@@ -66,7 +65,4 @@
   amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
   amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
   amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
-
-  /* We've got nothing to add to the common *BSD/amd64 target.  */
-  add_target (amd64bsd_target ());
 }
diff --git a/gdb/amd64obsd-nat.c b/gdb/amd64obsd-nat.c
index 6f8a601..0f9b5ef 100644
--- a/gdb/amd64obsd-nat.c
+++ b/gdb/amd64obsd-nat.c
@@ -22,7 +22,6 @@
 #include "defs.h"
 #include "gdbcore.h"
 #include "regcache.h"
-#include "target.h"
 
 #include "gdb_assert.h"
 
@@ -139,9 +138,6 @@
   amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64obsd32_r_reg_offset);
   amd64_native_gregset64_reg_offset = amd64obsd_r_reg_offset;
 
-  /* We've got nothing to add to the common *BSD/amd64 target.  */
-  add_target (amd64bsd_target ());
-
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (amd64obsd_supply_pcb);
 }
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index eac34b8..7e9e669 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2741,7 +2741,8 @@
 	struct value *v;
 	int found = 0;
 
-	if (!target_stopped_data_address (&current_target, &addr))
+	addr = target_stopped_data_address ();
+	if (addr == 0)
 	  continue;
 	for (v = b->val_chain; v; v = v->next)
 	  {
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 300379d..64869e5 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -285,7 +285,7 @@
   bsd_kvm_ops.to_open = bsd_kvm_open;
   bsd_kvm_ops.to_close = bsd_kvm_close;
   bsd_kvm_ops.to_fetch_registers = bsd_kvm_fetch_registers;
-  bsd_kvm_ops.deprecated_xfer_memory = bsd_kvm_xfer_memory;
+  bsd_kvm_ops.to_xfer_memory = bsd_kvm_xfer_memory;
   bsd_kvm_ops.to_stratum = process_stratum;
   bsd_kvm_ops.to_has_memory = 1;
   bsd_kvm_ops.to_has_stack = 1;
diff --git a/gdb/config.in b/gdb/config.in
index ed44c99..e97479f 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -263,9 +263,6 @@
 /* Define if you have the ttrace function.  */
 #undef HAVE_TTRACE
 
-/* Define if you have the wborder function.  */
-#undef HAVE_WBORDER
-
 /* Define if you have the <argz.h> header file.  */
 #undef HAVE_ARGZ_H
 
diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh
index 4983441..d3cbff7 100644
--- a/gdb/config/alpha/alpha-linux.mh
+++ b/gdb/config/alpha/alpha-linux.mh
@@ -1,7 +1,7 @@
 # Host: Little-endian Alpha running Linux
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
-	fork-child.o proc-service.o thread-db.o gcore.o \
+NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o linux-proc.o \
+	fork-child.o proc-service.o thread-db.o lin-lwp.o gcore.o \
 	linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh
index 386f681..af5b546 100644
--- a/gdb/config/arm/linux.mh
+++ b/gdb/config/arm/linux.mh
@@ -2,8 +2,8 @@
 
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o	\
-	core-regset.o arm-linux-nat.o gcore.o	\
-	proc-service.o thread-db.o linux-nat.o
+	core-regset.o arm-linux-nat.o linux-proc.o gcore.o	\
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 LOADLIBES= -ldl -rdynamic
 
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index a63c9d6..4337b72 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -138,8 +138,6 @@
 @V@/gdb/ia64-linux-nat.c @V@/gdb/ia64lx-tdep.c
 @V@/gdb/jv-exp.tab.c @V@/gdb/jv-exp_tab.c
 @V@/gdb/m2-exp.tab.c @V@/gdb/m2-exp_tab.c
-@V@/gdb/m32r-linux-nat.c @V@/gdb/m32rlnxnat.c
-@V@/gdb/m32r-linux-tdep.c @V@/gdb/m32rlnxtdep.c
 @V@/gdb/m68klinux-nat.c @V@/gdb/m68kl-nat.c
 @V@/gdb/m68klinux-tdep.c @V@/gdb/m68kl-tdep.c
 @V@/gdb/m68kbsd-nat.c @V@/gdb/m68bsd-nat.c
diff --git a/gdb/config/frv/tm-frv.h b/gdb/config/frv/tm-frv.h
index 4374872..b8f677d 100644
--- a/gdb/config/frv/tm-frv.h
+++ b/gdb/config/frv/tm-frv.h
@@ -1,5 +1,5 @@
 /* Target definitions for the Fujitsu FR-V, for GDB, the GNU Debugger.
-   Copyright 2000, 2004 Free Software Foundation, Inc.
+   Copyright 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,11 +33,10 @@
 #define STOPPED_BY_WATCHPOINT(W) \
    ((W).kind == TARGET_WAITKIND_STOPPED \
    && (W).value.sig == TARGET_SIGNAL_TRAP \
-   && frv_have_stopped_data_address())
-extern int frv_have_stopped_data_address(void);
+   && (frv_stopped_data_address() != ((CORE_ADDR)0)))
+extern CORE_ADDR frv_stopped_data_address(void);
 
 /* Use these macros for watchpoint insertion/deletion.  */
-#define target_stopped_data_address(target, x) frv_stopped_data_address(x)
-extern int frv_stopped_data_address(CORE_ADDR *addr_p);
+#define target_stopped_data_address() frv_stopped_data_address()
 
 #include "solib.h"		/* Include support for shared libraries.  */
diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh
index 291e121..fbbe5bf 100644
--- a/gdb/config/i386/fbsd.mh
+++ b/gdb/config/i386/fbsd.mh
@@ -1,5 +1,5 @@
 # Host: FreeBSD/i386
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \
 	fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \
 	gcore.o bsd-kvm.o
 NAT_FILE= nm-fbsd.h
diff --git a/gdb/config/i386/fbsd64.mh b/gdb/config/i386/fbsd64.mh
index f5817f1..d2dae25 100644
--- a/gdb/config/i386/fbsd64.mh
+++ b/gdb/config/i386/fbsd64.mh
@@ -1,6 +1,7 @@
 # Host: FreeBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
-	gcore.o bsd-kvm.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
+	amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
+	gcore.o fbsd-proc.o bsd-kvm.o
+NAT_FILE= nm-fbsd64.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh
index bfe29c1..3714e0c 100644
--- a/gdb/config/i386/linux.mh
+++ b/gdb/config/i386/linux.mh
@@ -1,9 +1,9 @@
 # Host: Intel 386 running GNU/Linux.
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
 	core-aout.o i386-nat.o i386-linux-nat.o \
-	proc-service.o thread-db.o gcore.o \
+	proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o \
 	linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/i386/linux64.mh b/gdb/config/i386/linux64.mh
index e9117cf..1622f18 100644
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
@@ -1,7 +1,7 @@
 # Host: GNU/Linux x86-64
 NATDEPFILES= infptrace.o inftarg.o fork-child.o \
 	i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
-	proc-service.o thread-db.o gcore.o 
+	proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o 
 NAT_FILE= nm-linux64.h
 
 # The dynamically loaded libthread_db needs access to symbols in the
diff --git a/gdb/config/i386/nbsd64.mh b/gdb/config/i386/nbsd64.mh
index aec2905..32f82a2 100644
--- a/gdb/config/i386/nbsd64.mh
+++ b/gdb/config/i386/nbsd64.mh
@@ -1,3 +1,4 @@
 # Host: NetBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
 	amd64-nat.o amd64bsd-nat.o amd64nbsd-nat.o
+NAT_FILE= config/nm-nbsd.h
diff --git a/gdb/config/i386/nbsdaout.mh b/gdb/config/i386/nbsdaout.mh
index 1614c4d..9f5e6c4 100644
--- a/gdb/config/i386/nbsdaout.mh
+++ b/gdb/config/i386/nbsdaout.mh
@@ -1,7 +1,7 @@
 # Host: NetBSD/i386 a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o
 	i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o \
 	solib.o solib-sunos.o
-NAT_FILE= solib.h
+NAT_FILE= nm-nbsdaout.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh
index e49a49a..2e5707d 100644
--- a/gdb/config/i386/nbsdelf.mh
+++ b/gdb/config/i386/nbsdelf.mh
@@ -1,6 +1,6 @@
 # Host: NetBSD/i386 ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \
 	i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o
-NAT_FILE= solib.h
+NAT_FILE= config/nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/i386/nm-fbsd.h b/gdb/config/i386/nm-fbsd.h
index 4c0aa36..1caff24 100644
--- a/gdb/config/i386/nm-fbsd.h
+++ b/gdb/config/i386/nm-fbsd.h
@@ -68,4 +68,59 @@
 
 #include "solib.h"
 
+/* Make structure definitions match up with those expected in
+   `solib-sunos.c'.  */
+
+#define link_object	sod
+#define lo_name		sod_name
+#define lo_library	sod_library
+#define lo_unused	sod_reserved
+#define lo_major	sod_major
+#define lo_minor	sod_minor
+#define lo_next		sod_next
+
+#define link_map	so_map
+#define lm_addr		som_addr
+#define lm_name		som_path
+#define lm_next		som_next
+#define lm_lop		som_sod
+#define lm_lob		som_sodbase
+#define lm_rwt		som_write
+#define lm_ld		som_dynamic
+#define lm_lpd		som_spd
+
+#define link_dynamic_2	section_dispatch_table
+#define ld_loaded	sdt_loaded
+#define ld_need		sdt_sods
+#define ld_rules	sdt_filler1
+#define ld_got		sdt_got
+#define ld_plt		sdt_plt
+#define ld_rel		sdt_rel
+#define ld_hash		sdt_hash
+#define ld_stab		sdt_nzlist
+#define ld_stab_hash	sdt_filler2
+#define ld_buckets	sdt_buckets
+#define ld_symbols	sdt_strings
+#define ld_symb_size	sdt_str_sz
+#define ld_text		sdt_text_sz
+#define ld_plt_sz	sdt_plt_sz
+
+#define rtc_symb	rt_symbol
+#define rtc_sp		rt_sp
+#define rtc_next	rt_next
+
+#define ld_debug	so_debug
+#define ldd_version	dd_version
+#define ldd_in_debugger	dd_in_debugger
+#define ldd_sym_loaded	dd_sym_loaded
+#define ldd_bp_addr	dd_bpt_addr
+#define ldd_bp_inst	dd_bpt_shadow
+#define ldd_cp		dd_cc
+
+#define link_dynamic	_dynamic
+#define ld_version	d_version
+#define ldd		d_debug
+#define ld_un		d_un
+#define ld_2		d_sdt
+
 #endif /* nm-fbsd.h */
diff --git a/gdb/config/m32r/nm-linux.h b/gdb/config/i386/nm-fbsd64.h
similarity index 68%
copy from gdb/config/m32r/nm-linux.h
copy to gdb/config/i386/nm-fbsd64.h
index ecfeeba..061e77e 100644
--- a/gdb/config/m32r/nm-linux.h
+++ b/gdb/config/i386/nm-fbsd64.h
@@ -1,5 +1,6 @@
-/* Definitions to make GDB run on an M32R based machine under GNU/Linux.
-   Copyright 2004 Free Software Foundation, Inc.
+/* Native-dependent definitions for FreeBSD/amd64.
+
+   Copyright 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,12 +19,13 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef NM_M32R_LINUX_H
-#define NM_M32R_LINUX_H
+#ifndef NM_FBSD64_H
+#define NM_FBSD64_H
 
-#include "config/nm-linux.h"
+/* Get generic BSD native definitions.  */
+#include "config/nm-bsd.h"
 
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c.  */
-#define FETCH_INFERIOR_REGISTERS
+/* Override child_pid_to_exec_file in 'inftarg.c'.  */
+#define CHILD_PID_TO_EXEC_FILE
 
-#endif /* NM_M32R_LINUX_H */
+#endif /* nm-fbsd64.h */
diff --git a/gdb/config/i386/nm-i386.h b/gdb/config/i386/nm-i386.h
index 265c8e0..2692cae 100644
--- a/gdb/config/i386/nm-i386.h
+++ b/gdb/config/i386/nm-i386.h
@@ -47,10 +47,10 @@
    triggered.  */
 extern int i386_stopped_by_hwbp (void);
 
-/* If the inferior has some break/watchpoint that triggered, set
-   the address associated with that break/watchpoint and return
-   true.  Otherwise, return false.  */
-extern int i386_stopped_data_address (CORE_ADDR *);
+/* If the inferior has some break/watchpoint that triggered, return
+   the address associated with that break/watchpoint.  Otherwise,
+   return zero.  */
+extern CORE_ADDR i386_stopped_data_address (void);
 
 /* Insert a hardware-assisted breakpoint at address ADDR.  SHADOW is
    unused.  Return 0 on success, EBUSY on failure.  */
@@ -91,11 +91,9 @@
 
 #define HAVE_CONTINUABLE_WATCHPOINT 1
 
-extern int i386_stopped_by_watchpoint (void);
+#define STOPPED_BY_WATCHPOINT(W)       (i386_stopped_data_address () != 0)
 
-#define STOPPED_BY_WATCHPOINT(W)       (i386_stopped_by_watchpoint () != 0)
-
-#define target_stopped_data_address(target, x)  i386_stopped_data_address(x)
+#define target_stopped_data_address()  i386_stopped_data_address ()
 
 /* Use these macros for watchpoint insertion/removal.  */
 
diff --git a/gdb/config/m32r/nm-linux.h b/gdb/config/i386/nm-nbsdaout.h
similarity index 68%
rename from gdb/config/m32r/nm-linux.h
rename to gdb/config/i386/nm-nbsdaout.h
index ecfeeba..81866ff 100644
--- a/gdb/config/m32r/nm-linux.h
+++ b/gdb/config/i386/nm-nbsdaout.h
@@ -1,5 +1,7 @@
-/* Definitions to make GDB run on an M32R based machine under GNU/Linux.
-   Copyright 2004 Free Software Foundation, Inc.
+/* Native-dependent definitions for NetBSD/i386 a.out.
+
+   Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000, 2004
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,12 +20,12 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef NM_M32R_LINUX_H
-#define NM_M32R_LINUX_H
+#ifndef NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
 
-#include "config/nm-linux.h"
+#include "config/nm-nbsd.h"
 
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c.  */
-#define FETCH_INFERIOR_REGISTERS
+/* Get generic NetBSD a.out native definitions.  */
+#include "config/nm-nbsdaout.h"
 
-#endif /* NM_M32R_LINUX_H */
+#endif /* nm-nbsdaout.h */
diff --git a/gdb/config/i386/nm-obsd.h b/gdb/config/i386/nm-obsd.h
index 571fb59..99d8b61 100644
--- a/gdb/config/i386/nm-obsd.h
+++ b/gdb/config/i386/nm-obsd.h
@@ -37,4 +37,59 @@
 
 #include "solib.h"
 
+/* Make structure definitions match up with those expected in
+   `solib-sunos.c'.  */
+
+#define link_object	sod
+#define lo_name		sod_name
+#define lo_library	sod_library
+#define lo_unused	sod_reserved
+#define lo_major	sod_major
+#define lo_minor	sod_minor
+#define lo_next		sod_next
+
+#define link_map	so_map
+#define lm_addr		som_addr
+#define lm_name		som_path
+#define lm_next		som_next
+#define lm_lop		som_sod
+#define lm_lob		som_sodbase
+#define lm_rwt		som_write
+#define lm_ld		som_dynamic
+#define lm_lpd		som_spd
+
+#define link_dynamic_2	section_dispatch_table
+#define ld_loaded	sdt_loaded
+#define ld_need		sdt_sods
+#define ld_rules	sdt_filler1
+#define ld_got		sdt_got
+#define ld_plt		sdt_plt
+#define ld_rel		sdt_rel
+#define ld_hash		sdt_hash
+#define ld_stab		sdt_nzlist
+#define ld_stab_hash	sdt_filler2
+#define ld_buckets	sdt_buckets
+#define ld_symbols	sdt_strings
+#define ld_symb_size	sdt_str_sz
+#define ld_text		sdt_text_sz
+#define ld_plt_sz	sdt_plt_sz
+
+#define rtc_symb	rt_symbol
+#define rtc_sp		rt_sp
+#define rtc_next	rt_next
+
+#define ld_debug	so_debug
+#define ldd_version	dd_version
+#define ldd_in_debugger	dd_in_debugger
+#define ldd_sym_loaded	dd_sym_loaded
+#define ldd_bp_addr	dd_bpt_addr
+#define ldd_bp_inst	dd_bpt_shadow
+#define ldd_cp		dd_cc
+
+#define link_dynamic	_dynamic
+#define ld_version	d_version
+#define ldd		d_debug
+#define ld_un		d_un
+#define ld_2		d_sdt
+
 #endif /* nm-obsd.h */
diff --git a/gdb/config/i386/obsd.mh b/gdb/config/i386/obsd.mh
index f5b4b2d..103ccec 100644
--- a/gdb/config/i386/obsd.mh
+++ b/gdb/config/i386/obsd.mh
@@ -1,5 +1,5 @@
 # Host: OpenBSD/i386 ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \
 	i386bsd-nat.o i386obsd-nat.o i386nbsd-nat.o bsd-kvm.o
 NAT_FILE= nm-obsd.h
 
diff --git a/gdb/config/i386/obsd64.mh b/gdb/config/i386/obsd64.mh
index 5c9899c..14d341c 100644
--- a/gdb/config/i386/obsd64.mh
+++ b/gdb/config/i386/obsd64.mh
@@ -1,5 +1,6 @@
 # Host: OpenBSD/amd64
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o \
 	amd64-nat.o amd64bsd-nat.o amd64obsd-nat.o bsd-kvm.o
+NAT_FILE= config/nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/i386/obsdaout.mh b/gdb/config/i386/obsdaout.mh
index 4124c79..656353d 100644
--- a/gdb/config/i386/obsdaout.mh
+++ b/gdb/config/i386/obsdaout.mh
@@ -1,5 +1,5 @@
 # Host: OpenBSD/i386 a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \
 	i386bsd-nat.o i386nbsd-nat.o i386obsd-nat.o bsd-kvm.o \
 	solib.o solib-sunos.o
 NAT_FILE= nm-obsd.h
diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh
index 5ad3145..71fed10 100644
--- a/gdb/config/ia64/linux.mh
+++ b/gdb/config/ia64/linux.mh
@@ -2,7 +2,7 @@
 
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
-	core-aout.o core-regset.o ia64-linux-nat.o \
-	proc-service.o thread-db.o linux-nat.o
+	core-aout.o core-regset.o ia64-linux-nat.o linux-proc.o \
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h
index fb8675f..1a5539a 100644
--- a/gdb/config/ia64/nm-linux.h
+++ b/gdb/config/ia64/nm-linux.h
@@ -58,12 +58,8 @@
 #define HAVE_STEPPABLE_WATCHPOINT 1
 
 #define STOPPED_BY_WATCHPOINT(W) \
-  ia64_linux_stopped_by_watchpoint ()
-extern int ia64_linux_stopped_by_watchpoint ();
-
-#define target_stopped_data_address(target, x) \
-  ia64_linux_stopped_data_address(x)
-extern int ia64_linux_stopped_data_address (CORE_ADDR *addr_p);
+  ia64_linux_stopped_by_watchpoint (inferior_ptid)
+extern CORE_ADDR ia64_linux_stopped_by_watchpoint (ptid_t ptid);
 
 #define target_insert_watchpoint(addr, len, type) \
   ia64_linux_insert_watchpoint (inferior_ptid, addr, len, type)
diff --git a/gdb/config/m32r/linux.mh b/gdb/config/m32r/linux.mh
deleted file mode 100644
index bfa8cf6..0000000
--- a/gdb/config/m32r/linux.mh
+++ /dev/null
@@ -1,8 +0,0 @@
-# Host: M32R based machine running GNU/Linux
-
-NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o	\
-	m32r-linux-nat.o gcore.o proc-service.o thread-db.o	\
-	linux-nat.o
-
-LOADLIBES= -ldl -rdynamic
diff --git a/gdb/config/m32r/linux.mt b/gdb/config/m32r/linux.mt
deleted file mode 100644
index 09e5630..0000000
--- a/gdb/config/m32r/linux.mt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Target: Renesas M32R running GNU/Linux
-TDEPFILES= m32r-tdep.o m32r-linux-tdep.o remote-m32r-sdi.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o
-DEPRECATED_TM_FILE= config/tm-linux.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/m32r/libsim.a
diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh
index 9e3e898..69dce24 100644
--- a/gdb/config/m68k/linux.mh
+++ b/gdb/config/m68k/linux.mh
@@ -2,8 +2,8 @@
 
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o \
-	corelow.o core-aout.o m68klinux-nat.o gcore.o \
-	proc-service.o thread-db.o linux-nat.o
+	corelow.o core-aout.o m68klinux-nat.o linux-proc.o gcore.o \
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
diff --git a/gdb/config/m88k/obsd.mh b/gdb/config/m88k/obsd.mh
index 02ef16a..e9281bc 100644
--- a/gdb/config/m88k/obsd.mh
+++ b/gdb/config/m88k/obsd.mh
@@ -1,2 +1,3 @@
 # Host: OpenBSD/m88k
-NATDEPFILES= fork-child.o inf-child.o m88kbsd-nat.o
+NATDEPFILES= m88kbsd-nat.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-bsd.h
diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh
index 44bac25..3fbc3e9 100644
--- a/gdb/config/mips/linux.mh
+++ b/gdb/config/mips/linux.mh
@@ -1,7 +1,7 @@
 # Host: Linux/MIPS
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
-	thread-db.o proc-service.o gcore.o \
+	thread-db.o lin-lwp.o proc-service.o linux-proc.o gcore.o \
 	linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/pa/linux.mh b/gdb/config/pa/linux.mh
index bc5a001..596857c 100644
--- a/gdb/config/pa/linux.mh
+++ b/gdb/config/pa/linux.mh
@@ -2,7 +2,7 @@
 XDEPFILES=
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
-	core-regset.o hppa-linux-nat.o \
-	proc-service.o thread-db.o linux-nat.o
+	core-regset.o hppa-linux-nat.o linux-proc.o \
+	proc-service.o thread-db.o lin-lwp.o linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index a7be199..450a777 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -3,8 +3,8 @@
 XM_CLIBS=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
-	ppc-linux-nat.o proc-service.o thread-db.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
+	ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
 	gcore.o linux-nat.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh
index 5556886..4e7388b 100644
--- a/gdb/config/powerpc/nbsd.mh
+++ b/gdb/config/powerpc/nbsd.mh
@@ -1,5 +1,5 @@
 # Host: PowerPC, running NetBSD
-NATDEPFILES= fork-child.o inf-ptrace.o infptrace.o ppcnbsd-nat.o bsd-kvm.o
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o ppcnbsd-nat.o bsd-kvm.o
 NAT_FILE= config/nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh
index 2c42fc7..b22408a 100644
--- a/gdb/config/powerpc/ppc64-linux.mh
+++ b/gdb/config/powerpc/ppc64-linux.mh
@@ -3,8 +3,8 @@
 XM_CLIBS=
 
 NAT_FILE= nm-ppc64-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
-	ppc-linux-nat.o proc-service.o thread-db.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
+	ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
 	gcore.o linux-nat.o
 
 # The PowerPC has severe limitations on TOC size, and uses them even
diff --git a/gdb/config/s390/s390.mh b/gdb/config/s390/s390.mh
index 2b5f190..3db7bd9 100644
--- a/gdb/config/s390/s390.mh
+++ b/gdb/config/s390/s390.mh
@@ -1,5 +1,5 @@
 # Host: S390, running Linux
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
-	gcore.o thread-db.o proc-service.o linux-nat.o
+	linux-proc.o gcore.o thread-db.o lin-lwp.o proc-service.o linux-nat.o
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/sparc/fbsd.mh b/gdb/config/sparc/fbsd.mh
index ec9a31a..fb491a5 100644
--- a/gdb/config/sparc/fbsd.mh
+++ b/gdb/config/sparc/fbsd.mh
@@ -1,5 +1,5 @@
 # Host: FreeBSD/sparc64
 NATDEPFILES= sparc64fbsd-nat.o sparc64-nat.o sparc-nat.o \
-	fork-child.o inf-ptrace.o infptrace.o inftarg.o \
+	fork-child.o infptrace.o inftarg.o \
 	solib.o solib-svr4.o solib-legacy.o
 NAT_FILE= nm-fbsd.h
diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh
index abd3ed8..ed68cc7 100644
--- a/gdb/config/sparc/linux.mh
+++ b/gdb/config/sparc/linux.mh
@@ -1,10 +1,10 @@
 # Host: GNU/Linux SPARC
 NAT_FILE= nm-linux.h
 NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
-	corelow.o core-regset.o fork-child.o inf-ptrace.o \
+	corelow.o core-regset.o fork-child.o \
 	infptrace.o inftarg.o \
-	proc-service.o thread-db.o \
-	gcore.o linux-nat.o
+	proc-service.o thread-db.o lin-lwp.o \
+	linux-proc.o gcore.o linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
diff --git a/gdb/config/sparc/linux64.mh b/gdb/config/sparc/linux64.mh
index 05a63b0..c1472de 100644
--- a/gdb/config/sparc/linux64.mh
+++ b/gdb/config/sparc/linux64.mh
@@ -2,9 +2,9 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
 	corelow.o core-regset.o \
-	fork-child.o inf-ptrace.o infptrace.o inftarg.o \
-	proc-service.o thread-db.o \
-	gcore.o linux-nat.o
+	fork-child.o infptrace.o inftarg.o \
+	proc-service.o thread-db.o lin-lwp.o \
+	linux-proc.o gcore.o linux-nat.o
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.
diff --git a/gdb/config/sparc/nbsd64.mh b/gdb/config/sparc/nbsd64.mh
index 95d4166..9ac8cf4 100644
--- a/gdb/config/sparc/nbsd64.mh
+++ b/gdb/config/sparc/nbsd64.mh
@@ -1,6 +1,6 @@
 # Host: NetBSD/sparc64
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o
+NATDEPFILES= sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o \
+	fork-child.o infptrace.o inftarg.o
 NAT_FILE= nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/sparc/nbsdaout.mh b/gdb/config/sparc/nbsdaout.mh
index cd0067d..8944e60 100644
--- a/gdb/config/sparc/nbsdaout.mh
+++ b/gdb/config/sparc/nbsdaout.mh
@@ -1,6 +1,4 @@
 # Host: NetBSD/sparc a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
-NAT_FILE= nm-nbsd.h
-
-LOADLIBES= -lkvm
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o \
+	fork-child.o infptrace.o inftarg.o solib-sunos.o
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh
index d258fcc..611a6a4 100644
--- a/gdb/config/sparc/nbsdelf.mh
+++ b/gdb/config/sparc/nbsdelf.mh
@@ -1,6 +1,6 @@
 # Host: NetBSD/sparc ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	sparc-nat.o sparcnbsd-nat.o bsd-kvm.o
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o bsd-kvm.o \
+	fork-child.o infptrace.o inftarg.o
 NAT_FILE= nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/vax/nbsdaout.mh b/gdb/config/vax/nbsdaout.mh
index faf42b5..6887135 100644
--- a/gdb/config/vax/nbsdaout.mh
+++ b/gdb/config/vax/nbsdaout.mh
@@ -1,6 +1,5 @@
 # Host: NetBSD/vax a.out
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	vaxbsd-nat.o bsd-kvm.o \
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o \
 	solib.o solib-sunos.o
 NAT_FILE= nm-nbsdaout.h
 
diff --git a/gdb/config/vax/nbsdelf.mh b/gdb/config/vax/nbsdelf.mh
index dd9441b..06dda18 100644
--- a/gdb/config/vax/nbsdelf.mh
+++ b/gdb/config/vax/nbsdelf.mh
@@ -1,5 +1,5 @@
 # Host: NetBSD/vax ELF
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	vaxbsd-nat.o bsd-kvm.o
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-nbsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/config/vax/obsd.mh b/gdb/config/vax/obsd.mh
index d4d444f..416f2c6 100644
--- a/gdb/config/vax/obsd.mh
+++ b/gdb/config/vax/obsd.mh
@@ -1,5 +1,5 @@
 # Host: OpenBSD/vax
-NATDEPFILES= fork-child.o inf-ptrace.o \
-	vaxbsd-nat.o bsd-kvm.o
+NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o
+NAT_FILE= config/nm-bsd.h
 
 LOADLIBES= -lkvm
diff --git a/gdb/configure b/gdb/configure
index be9c105..1648224 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -3094,6 +3094,21 @@
   enable_tui=yes
 fi
 
+if test x"$enable_tui" = xyes; then
+  if test -d $srcdir/tui; then
+    if test "$ac_cv_search_mvwaddstr" != no; then
+      CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
+      CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
+      CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
+      CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
+      ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
+      CONFIG_ALL="${CONFIG_ALL} all-tui"
+      CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
+      CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
+      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
+    fi
+  fi
+fi
 
 # Enable gdbtk.
 # Check whether --enable-gdbtk or --disable-gdbtk was given.
@@ -3135,17 +3150,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3139: checking for $ac_hdr" >&5
+echo "configure:3154: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3144 "configure"
+#line 3159 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3175,17 +3190,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3179: checking for $ac_hdr" >&5
+echo "configure:3194: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3184 "configure"
+#line 3199 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3223,17 +3238,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3227: checking for $ac_hdr" >&5
+echo "configure:3242: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3232 "configure"
+#line 3247 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3263,17 +3278,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3267: checking for $ac_hdr" >&5
+echo "configure:3282: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3272 "configure"
+#line 3287 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3277: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3326,12 +3341,12 @@
 for ac_func in monstartup _mcleanup
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3330: checking for $ac_func" >&5
+echo "configure:3345: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3335 "configure"
+#line 3350 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3354,7 +3369,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3379,12 +3394,12 @@
 done
 
 echo $ac_n "checking for _etext""... $ac_c" 1>&6
-echo "configure:3383: checking for _etext" >&5
+echo "configure:3398: checking for _etext" >&5
 if eval "test \"`echo '$''{'ac_cv_var__etext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3388 "configure"
+#line 3403 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 extern char _etext;
@@ -3393,7 +3408,7 @@
 free (&_etext);
 ; return 0; }
 EOF
-if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var__etext=yes
 else
@@ -3421,19 +3436,19 @@
   CFLAGS="$CFLAGS $PROFILE_CFLAGS"
 
   echo $ac_n "checking whether $CC supports -pg""... $ac_c" 1>&6
-echo "configure:3425: checking whether $CC supports -pg" >&5
+echo "configure:3440: checking whether $CC supports -pg" >&5
 if eval "test \"`echo '$''{'ac_cv_cc_supports_pg'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3430 "configure"
+#line 3445 "configure"
 #include "confdefs.h"
 
 int main() {
 int x;
 ; return 0; }
 EOF
-if { (eval echo configure:3437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cc_supports_pg=yes
 else
@@ -3463,7 +3478,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3467: checking for $ac_word" >&5
+echo "configure:3482: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3504,7 +3519,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:3508: checking for a BSD compatible install" >&5
+echo "configure:3523: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3557,7 +3572,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3561: checking whether ln -s works" >&5
+echo "configure:3576: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3580,7 +3595,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3584: checking for $ac_word" >&5
+echo "configure:3599: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3612,7 +3627,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3616: checking for $ac_word" >&5
+echo "configure:3631: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3646,7 +3661,7 @@
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3650: checking for $ac_word" >&5
+echo "configure:3665: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3678,7 +3693,7 @@
 # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ac_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3682: checking for $ac_word" >&5
+echo "configure:3697: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3710,7 +3725,7 @@
 # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ac_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3714: checking for $ac_word" >&5
+echo "configure:3729: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3744,7 +3759,7 @@
 # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
 set dummy ${ac_tool_prefix}mig; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3748: checking for $ac_word" >&5
+echo "configure:3763: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3780,7 +3795,7 @@
 
 # We might need to link with -lm; most simulators need it.
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:3784: checking for main in -lm" >&5
+echo "configure:3799: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3788,14 +3803,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3792 "configure"
+#line 3807 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3828,12 +3843,12 @@
 # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
 # is known to have this problem).  Therefore we avoid libw if we can.
 echo $ac_n "checking for wctype""... $ac_c" 1>&6
-echo "configure:3832: checking for wctype" >&5
+echo "configure:3847: checking for wctype" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wctype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3837 "configure"
+#line 3852 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char wctype(); below.  */
@@ -3856,7 +3871,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_wctype=yes"
 else
@@ -3874,7 +3889,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6
-echo "configure:3878: checking for wctype in -lw" >&5
+echo "configure:3893: checking for wctype in -lw" >&5
 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3882,7 +3897,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lw  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3886 "configure"
+#line 3901 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3893,7 +3908,7 @@
 wctype()
 ; return 0; }
 EOF
-if { (eval echo configure:3897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3926,14 +3941,14 @@
 # Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
 
 echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6
-echo "configure:3930: checking for library containing gethostbyname" >&5
+echo "configure:3945: checking for library containing gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_gethostbyname="no"
 cat > conftest.$ac_ext <<EOF
-#line 3937 "configure"
+#line 3952 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3944,7 +3959,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_gethostbyname="none required"
 else
@@ -3955,7 +3970,7 @@
 test "$ac_cv_search_gethostbyname" = "no" && for i in nsl; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3959 "configure"
+#line 3974 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3966,7 +3981,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_gethostbyname="-l$i"
 break
@@ -3990,14 +4005,14 @@
 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
 
 echo $ac_n "checking for library containing socketpair""... $ac_c" 1>&6
-echo "configure:3994: checking for library containing socketpair" >&5
+echo "configure:4009: checking for library containing socketpair" >&5
 if eval "test \"`echo '$''{'ac_cv_search_socketpair'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_socketpair="no"
 cat > conftest.$ac_ext <<EOF
-#line 4001 "configure"
+#line 4016 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4008,7 +4023,7 @@
 socketpair()
 ; return 0; }
 EOF
-if { (eval echo configure:4012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socketpair="none required"
 else
@@ -4019,7 +4034,7 @@
 test "$ac_cv_search_socketpair" = "no" && for i in socket; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4023 "configure"
+#line 4038 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4030,7 +4045,7 @@
 socketpair()
 ; return 0; }
 EOF
-if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socketpair="-l$i"
 break
@@ -4057,54 +4072,54 @@
 # curses library because the latter might not provide all the
 # functionality we need.  However, this leads to problems on systems
 # where the linker searches /usr/local/lib, but the compiler doesn't
-# search /usr/local/include, if ncurses is installed in /usr/local.  A
+# search /usr/local/include if ncurses is installed in /usr/local.  A
 # default installation of ncurses on alpha*-dec-osf* will lead to such
 # a situation.
 
-echo $ac_n "checking for library containing waddstr""... $ac_c" 1>&6
-echo "configure:4066: checking for library containing waddstr" >&5
-if eval "test \"`echo '$''{'ac_cv_search_waddstr'+set}'`\" = set"; then
+echo $ac_n "checking for library containing mvwaddstr""... $ac_c" 1>&6
+echo "configure:4081: checking for library containing mvwaddstr" >&5
+if eval "test \"`echo '$''{'ac_cv_search_mvwaddstr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
-ac_cv_search_waddstr="no"
+ac_cv_search_mvwaddstr="no"
 cat > conftest.$ac_ext <<EOF
-#line 4073 "configure"
+#line 4088 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char waddstr();
+char mvwaddstr();
 
 int main() {
-waddstr()
+mvwaddstr()
 ; return 0; }
 EOF
-if { (eval echo configure:4084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_search_waddstr="none required"
+  ac_cv_search_mvwaddstr="none required"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
 fi
 rm -f conftest*
-test "$ac_cv_search_waddstr" = "no" && for i in ncurses cursesX curses; do
+test "$ac_cv_search_mvwaddstr" = "no" && for i in ncurses cursesX curses; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4095 "configure"
+#line 4110 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char waddstr();
+char mvwaddstr();
 
 int main() {
-waddstr()
+mvwaddstr()
 ; return 0; }
 EOF
-if { (eval echo configure:4106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_search_waddstr="-l$i"
+  ac_cv_search_mvwaddstr="-l$i"
 break
 else
   echo "configure: failed program was:" >&5
@@ -4115,14 +4130,18 @@
 LIBS="$ac_func_search_save_LIBS"
 fi
 
-echo "$ac_t""$ac_cv_search_waddstr" 1>&6
-if test "$ac_cv_search_waddstr" != "no"; then
-  test "$ac_cv_search_waddstr" = "none required" || LIBS="$ac_cv_search_waddstr $LIBS"
+echo "$ac_t""$ac_cv_search_mvwaddstr" 1>&6
+if test "$ac_cv_search_mvwaddstr" != "no"; then
+  test "$ac_cv_search_mvwaddstr" = "none required" || LIBS="$ac_cv_search_mvwaddstr $LIBS"
   
 else :
   
 fi
 
+if test "$ac_cv_search_mvwaddstr" = no; then
+  echo "configure: warning: no curses library found" 1>&2
+fi
+
 # Since GDB uses Readline, we need termcap functionality.  In many
 # cases this will be provided by the curses library, but some systems
 # have a seperate termcap library, or no curses library at all.
@@ -4141,14 +4160,14 @@
 # These are the libraries checked by Readline.
 
 echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6
-echo "configure:4145: checking for library containing tgetent" >&5
+echo "configure:4164: checking for library containing tgetent" >&5
 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_tgetent="no"
 cat > conftest.$ac_ext <<EOF
-#line 4152 "configure"
+#line 4171 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4159,7 +4178,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:4163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="none required"
 else
@@ -4170,7 +4189,7 @@
 test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo curses ncurses; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4174 "configure"
+#line 4193 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4181,7 +4200,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:4185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="-l$i"
 break
@@ -4215,12 +4234,12 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4219: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4238: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4224 "configure"
+#line 4243 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4228,7 +4247,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4251: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4253,7 +4272,7 @@
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4257: checking for opendir in -ldir" >&5
+echo "configure:4276: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4261,7 +4280,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4265 "configure"
+#line 4284 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4272,7 +4291,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4294,7 +4313,7 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4298: checking for opendir in -lx" >&5
+echo "configure:4317: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4302,7 +4321,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4306 "configure"
+#line 4325 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4313,7 +4332,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4336,12 +4355,12 @@
 fi
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4340: checking whether stat file-mode macros are broken" >&5
+echo "configure:4359: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4345 "configure"
+#line 4364 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -4392,12 +4411,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4396: checking for ANSI C header files" >&5
+echo "configure:4415: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4401 "configure"
+#line 4420 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -4405,7 +4424,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4422,7 +4441,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4426 "configure"
+#line 4445 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -4440,7 +4459,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4444 "configure"
+#line 4463 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4461,7 +4480,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 4465 "configure"
+#line 4484 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4472,7 +4491,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:4476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4499,17 +4518,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4503: checking for $ac_hdr" >&5
+echo "configure:4522: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4508 "configure"
+#line 4527 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4539,17 +4558,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4543: checking for $ac_hdr" >&5
+echo "configure:4562: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4548 "configure"
+#line 4567 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4579,17 +4598,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4583: checking for $ac_hdr" >&5
+echo "configure:4602: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4588 "configure"
+#line 4607 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4619,17 +4638,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4623: checking for $ac_hdr" >&5
+echo "configure:4642: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4628 "configure"
+#line 4647 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4659,17 +4678,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4663: checking for $ac_hdr" >&5
+echo "configure:4682: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4668 "configure"
+#line 4687 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4699,17 +4718,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4703: checking for $ac_hdr" >&5
+echo "configure:4722: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4708 "configure"
+#line 4727 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4739,17 +4758,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4743: checking for $ac_hdr" >&5
+echo "configure:4762: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4748 "configure"
+#line 4767 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4753: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4779,17 +4798,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4783: checking for $ac_hdr" >&5
+echo "configure:4802: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4788 "configure"
+#line 4807 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4819,17 +4838,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4823: checking for $ac_hdr" >&5
+echo "configure:4842: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4828 "configure"
+#line 4847 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4859,17 +4878,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4863: checking for $ac_hdr" >&5
+echo "configure:4882: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4868 "configure"
+#line 4887 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4899,17 +4918,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4903: checking for $ac_hdr" >&5
+echo "configure:4922: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4908 "configure"
+#line 4927 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4939,17 +4958,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4943: checking for $ac_hdr" >&5
+echo "configure:4962: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4948 "configure"
+#line 4967 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4979,17 +4998,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4983: checking for $ac_hdr" >&5
+echo "configure:5002: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4988 "configure"
+#line 5007 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5019,17 +5038,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5023: checking for $ac_hdr" >&5
+echo "configure:5042: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5028 "configure"
+#line 5047 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5059,17 +5078,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5063: checking for $ac_hdr" >&5
+echo "configure:5082: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5068 "configure"
+#line 5087 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5099,17 +5118,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5103: checking for $ac_hdr" >&5
+echo "configure:5122: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5108 "configure"
+#line 5127 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5139,17 +5158,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5143: checking for $ac_hdr" >&5
+echo "configure:5162: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5148 "configure"
+#line 5167 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5179,17 +5198,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5183: checking for $ac_hdr" >&5
+echo "configure:5202: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5188 "configure"
+#line 5207 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5219,17 +5238,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5223: checking for $ac_hdr" >&5
+echo "configure:5242: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5228 "configure"
+#line 5247 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5259,17 +5278,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5263: checking for $ac_hdr" >&5
+echo "configure:5282: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5268 "configure"
+#line 5287 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5299,17 +5318,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5303: checking for $ac_hdr" >&5
+echo "configure:5322: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5308 "configure"
+#line 5327 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5332: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5339,17 +5358,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5343: checking for $ac_hdr" >&5
+echo "configure:5362: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5348 "configure"
+#line 5367 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5379,17 +5398,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5383: checking for $ac_hdr" >&5
+echo "configure:5402: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5388 "configure"
+#line 5407 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5419,17 +5438,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5423: checking for $ac_hdr" >&5
+echo "configure:5442: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5428 "configure"
+#line 5447 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5459,17 +5478,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5463: checking for $ac_hdr" >&5
+echo "configure:5482: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5468 "configure"
+#line 5487 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5512,17 +5531,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5516: checking for $ac_hdr" >&5
+echo "configure:5535: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5521 "configure"
+#line 5540 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5555,17 +5574,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5559: checking for $ac_hdr" >&5
+echo "configure:5578: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5564 "configure"
+#line 5583 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5593,12 +5612,12 @@
 
 
 echo $ac_n "checking for member st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:5597: checking for member st_blocks in struct stat" >&5
+echo "configure:5616: checking for member st_blocks in struct stat" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_struct_stat_with_st_blocks_member'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5602 "configure"
+#line 5621 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -5606,7 +5625,7 @@
 struct stat st; (void) st.st_blocks;
 ; return 0; }
 EOF
-if { (eval echo configure:5610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_stat_with_st_blocks_member=yes
 else
@@ -5634,12 +5653,12 @@
 do
   ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6
-echo "configure:5638: checking whether $ac_func is declared" >&5
+echo "configure:5657: checking whether $ac_func is declared" >&5
 if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5643 "configure"
+#line 5662 "configure"
 #include "confdefs.h"
 #undef $ac_tr_decl
 #define $ac_tr_decl 1
@@ -5651,7 +5670,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:5655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "gcc_cv_have_decl_$ac_func=yes"
 else
@@ -5688,12 +5707,12 @@
 # ------------------ #
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:5692: checking return type of signal handlers" >&5
+echo "configure:5711: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5697 "configure"
+#line 5716 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -5710,7 +5729,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -5734,12 +5753,12 @@
 # ------------------------------------- #
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5738: checking for working const" >&5
+echo "configure:5757: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5743 "configure"
+#line 5762 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5788,7 +5807,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -5809,21 +5828,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5813: checking for inline" >&5
+echo "configure:5832: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 5820 "configure"
+#line 5839 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:5827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -5856,19 +5875,19 @@
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5860: checking for working alloca.h" >&5
+echo "configure:5879: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5865 "configure"
+#line 5884 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5889,12 +5908,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5893: checking for alloca" >&5
+echo "configure:5912: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5898 "configure"
+#line 5917 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5922,7 +5941,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5954,12 +5973,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5958: checking whether alloca needs Cray hooks" >&5
+echo "configure:5977: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5963 "configure"
+#line 5982 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5984,12 +6003,12 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5988: checking for $ac_func" >&5
+echo "configure:6007: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5993 "configure"
+#line 6012 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6012,7 +6031,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6039,7 +6058,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:6043: checking stack direction for C alloca" >&5
+echo "configure:6062: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6047,7 +6066,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 6051 "configure"
+#line 6070 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -6066,7 +6085,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:6070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -6091,17 +6110,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6095: checking for $ac_hdr" >&5
+echo "configure:6114: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6100 "configure"
+#line 6119 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6130,12 +6149,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6134: checking for $ac_func" >&5
+echo "configure:6153: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6139 "configure"
+#line 6158 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6158,7 +6177,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6183,7 +6202,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6187: checking for working mmap" >&5
+echo "configure:6206: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6191,7 +6210,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 6195 "configure"
+#line 6214 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6331,7 +6350,7 @@
 }
 
 EOF
-if { (eval echo configure:6335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -6354,12 +6373,12 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:6358: checking for pid_t" >&5
+echo "configure:6377: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6363 "configure"
+#line 6382 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6388,17 +6407,17 @@
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:6392: checking for vfork.h" >&5
+echo "configure:6411: checking for vfork.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6397 "configure"
+#line 6416 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6423,18 +6442,18 @@
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:6427: checking for working vfork" >&5
+echo "configure:6446: checking for working vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:6433: checking for vfork" >&5
+echo "configure:6452: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6438 "configure"
+#line 6457 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -6457,7 +6476,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -6479,7 +6498,7 @@
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 6483 "configure"
+#line 6502 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -6574,7 +6593,7 @@
   }
 }
 EOF
-if { (eval echo configure:6578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -6599,12 +6618,12 @@
 for ac_func in canonicalize_file_name realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6603: checking for $ac_func" >&5
+echo "configure:6622: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6608 "configure"
+#line 6627 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6627,7 +6646,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6654,12 +6673,12 @@
 for ac_func in poll
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6658: checking for $ac_func" >&5
+echo "configure:6677: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6663 "configure"
+#line 6682 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6682,7 +6701,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6709,12 +6728,12 @@
 for ac_func in pread64
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6713: checking for $ac_func" >&5
+echo "configure:6732: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6718 "configure"
+#line 6737 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6737,7 +6756,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6764,12 +6783,12 @@
 for ac_func in sbrk
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6768: checking for $ac_func" >&5
+echo "configure:6787: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6773 "configure"
+#line 6792 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6792,7 +6811,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6819,12 +6838,12 @@
 for ac_func in setpgid setpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6823: checking for $ac_func" >&5
+echo "configure:6842: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6828 "configure"
+#line 6847 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6847,7 +6866,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6874,12 +6893,12 @@
 for ac_func in sigaction sigprocmask sigsetmask
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6878: checking for $ac_func" >&5
+echo "configure:6897: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6883 "configure"
+#line 6902 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6902,7 +6921,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6929,12 +6948,12 @@
 for ac_func in socketpair
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6933: checking for $ac_func" >&5
+echo "configure:6952: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6938 "configure"
+#line 6957 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6957,7 +6976,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6984,12 +7003,12 @@
 for ac_func in syscall
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6988: checking for $ac_func" >&5
+echo "configure:7007: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6993 "configure"
+#line 7012 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7012,7 +7031,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7039,12 +7058,12 @@
 for ac_func in ttrace
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7043: checking for $ac_func" >&5
+echo "configure:7062: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7048 "configure"
+#line 7067 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7067,62 +7086,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- 
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in wborder
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7098: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 7103 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:7126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7165,12 +7129,12 @@
 do
   ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6
-echo "configure:7169: checking whether $ac_func is declared" >&5
+echo "configure:7133: checking whether $ac_func is declared" >&5
 if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7174 "configure"
+#line 7138 "configure"
 #include "confdefs.h"
 #undef $ac_tr_decl
 #define $ac_tr_decl 1
@@ -7182,7 +7146,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:7186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "gcc_cv_have_decl_$ac_func=yes"
 else
@@ -7218,19 +7182,19 @@
 
 # Check return type.
 echo $ac_n "checking return type of ptrace""... $ac_c" 1>&6
-echo "configure:7222: checking return type of ptrace" >&5
+echo "configure:7186: checking return type of ptrace" >&5
 if eval "test \"`echo '$''{'gdb_cv_func_ptrace_ret'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7227 "configure"
+#line 7191 "configure"
 #include "confdefs.h"
 $gdb_ptrace_headers
 int main() {
 extern int ptrace ();
 ; return 0; }
 EOF
-if { (eval echo configure:7234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_func_ptrace_ret='int'
 else
@@ -7249,7 +7213,7 @@
 
 # Check argument types.
 echo $ac_n "checking types of arguments for ptrace""... $ac_c" 1>&6
-echo "configure:7253: checking types of arguments for ptrace" >&5
+echo "configure:7217: checking types of arguments for ptrace" >&5
 if eval "test \"`echo '$''{'gdb_cv_func_ptrace_args'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7259,7 +7223,7 @@
   for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
    for gdb_arg4 in 'int' 'long'; do
      cat > conftest.$ac_ext <<EOF
-#line 7263 "configure"
+#line 7227 "configure"
 #include "confdefs.h"
 $gdb_ptrace_headers
 int main() {
@@ -7269,7 +7233,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
     break 4;
@@ -7280,7 +7244,7 @@
 rm -f conftest*
     for gdb_arg5 in 'int *' 'int' 'long'; do
      cat > conftest.$ac_ext <<EOF
-#line 7284 "configure"
+#line 7248 "configure"
 #include "confdefs.h"
 $gdb_ptrace_headers
 int main() {
@@ -7290,7 +7254,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
@@ -7328,7 +7292,7 @@
 
 if test "$cross_compiling" = no; then
   echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:7332: checking whether setpgrp takes no argument" >&5
+echo "configure:7296: checking whether setpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7336,7 +7300,7 @@
   { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7340 "configure"
+#line 7304 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -7356,7 +7320,7 @@
 }
 
 EOF
-if { (eval echo configure:7360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setpgrp_void=no
 else
@@ -7381,12 +7345,12 @@
 
 else
   echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:7385: checking whether setpgrp takes no argument" >&5
+echo "configure:7349: checking whether setpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7390 "configure"
+#line 7354 "configure"
 #include "confdefs.h"
 
 #include <unistd.h>
@@ -7400,7 +7364,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_func_setpgrp_void=no
 else
@@ -7424,12 +7388,12 @@
 # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
 # since sigsetjmp might only be defined as a macro.
 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:7428: checking for sigsetjmp" >&5
+echo "configure:7392: checking for sigsetjmp" >&5
 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7433 "configure"
+#line 7397 "configure"
 #include "confdefs.h"
 
 #include <setjmp.h>
@@ -7438,7 +7402,7 @@
 sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);
 ; return 0; }
 EOF
-if { (eval echo configure:7442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7406: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_func_sigsetjmp=yes
 else
@@ -7464,12 +7428,12 @@
 # However, if the system regex is GNU regex, then default to *not*
 # using the included regex.
 echo $ac_n "checking for GNU regex""... $ac_c" 1>&6
-echo "configure:7468: checking for GNU regex" >&5
+echo "configure:7432: checking for GNU regex" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7473 "configure"
+#line 7437 "configure"
 #include "confdefs.h"
 #include <gnu-versions.h>
 int main() {
@@ -7479,7 +7443,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:7483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_gnu_regex=yes
 else
@@ -7513,12 +7477,12 @@
 
 # See if <sys/proc.h> defines `struct thread' with a td_pcb member.
 echo $ac_n "checking for td_pcb in struct thread""... $ac_c" 1>&6
-echo "configure:7517: checking for td_pcb in struct thread" >&5
+echo "configure:7481: checking for td_pcb in struct thread" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_thread_td_pcb'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7522 "configure"
+#line 7486 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -7526,7 +7490,7 @@
 struct thread td; td.td_pcb;
 ; return 0; }
 EOF
-if { (eval echo configure:7530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_thread_td_pcb=yes
 else
@@ -7548,12 +7512,12 @@
 
 # See if <sys/lwp.h> defines `struct lwp`.
 echo $ac_n "checking for struct lwp""... $ac_c" 1>&6
-echo "configure:7552: checking for struct lwp" >&5
+echo "configure:7516: checking for struct lwp" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_lwp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7557 "configure"
+#line 7521 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 #include <sys/lwp.h>
@@ -7561,7 +7525,7 @@
 struct lwp l;
 ; return 0; }
 EOF
-if { (eval echo configure:7565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_lwp=yes
 else
@@ -7583,12 +7547,12 @@
 
 # See if <machine/reg.h> degines `struct reg'.
 echo $ac_n "checking for struct reg in machine/reg.h""... $ac_c" 1>&6
-echo "configure:7587: checking for struct reg in machine/reg.h" >&5
+echo "configure:7551: checking for struct reg in machine/reg.h" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_reg'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7592 "configure"
+#line 7556 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <machine/reg.h>
@@ -7596,7 +7560,7 @@
 struct reg r;
 ; return 0; }
 EOF
-if { (eval echo configure:7600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg=yes
 else
@@ -7619,19 +7583,19 @@
 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
 echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6
-echo "configure:7623: checking for r_fs in struct reg" >&5
+echo "configure:7587: checking for r_fs in struct reg" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7628 "configure"
+#line 7592 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_fs;
 ; return 0; }
 EOF
-if { (eval echo configure:7635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_fs=yes
 else
@@ -7651,19 +7615,19 @@
 
 fi
 echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6
-echo "configure:7655: checking for r_gs in struct reg" >&5
+echo "configure:7619: checking for r_gs in struct reg" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7660 "configure"
+#line 7624 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_gs;
 ; return 0; }
 EOF
-if { (eval echo configure:7667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_gs=yes
 else
@@ -7685,19 +7649,19 @@
 
 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
 echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6
-echo "configure:7689: checking for PTRACE_GETREGS" >&5
+echo "configure:7653: checking for PTRACE_GETREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7694 "configure"
+#line 7658 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
 PTRACE_GETREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:7701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_ptrace_getregs=yes
 else
@@ -7719,19 +7683,19 @@
 
 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
 echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6
-echo "configure:7723: checking for PTRACE_GETFPXREGS" >&5
+echo "configure:7687: checking for PTRACE_GETFPXREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7728 "configure"
+#line 7692 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
 PTRACE_GETFPXREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:7735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_ptrace_getfpxregs=yes
 else
@@ -7753,12 +7717,12 @@
 
 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
 echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6
-echo "configure:7757: checking for PT_GETDBREGS" >&5
+echo "configure:7721: checking for PT_GETDBREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7762 "configure"
+#line 7726 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ptrace.h>
@@ -7766,7 +7730,7 @@
 PT_GETDBREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:7770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_pt_getdbregs=yes
 else
@@ -7788,12 +7752,12 @@
 
 # See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
 echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6
-echo "configure:7792: checking for PT_GETXMMREGS" >&5
+echo "configure:7756: checking for PT_GETXMMREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7797 "configure"
+#line 7761 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ptrace.h>
@@ -7801,7 +7765,7 @@
 PT_GETXMMREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:7805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_pt_getxmmregs=yes
 else
@@ -7824,19 +7788,19 @@
 # See if stdint.h provides the uintptr_t type.
 # Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
 echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6
-echo "configure:7828: checking for uintptr_t in stdint.h" >&5
+echo "configure:7792: checking for uintptr_t in stdint.h" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7833 "configure"
+#line 7797 "configure"
 #include "confdefs.h"
 #include <stdint.h>
 int main() {
 uintptr_t foo = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:7840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_uintptr_t=yes
 else
@@ -7857,12 +7821,12 @@
 fi
 
 echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:7861: checking whether malloc must be declared" >&5
+echo "configure:7825: checking whether malloc must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7866 "configure"
+#line 7830 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7883,7 +7847,7 @@
 char *(*pfn) = (char *(*)) malloc
 ; return 0; }
 EOF
-if { (eval echo configure:7887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_malloc=no
 else
@@ -7904,12 +7868,12 @@
 fi
 
 echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:7908: checking whether realloc must be declared" >&5
+echo "configure:7872: checking whether realloc must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7913 "configure"
+#line 7877 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7930,7 +7894,7 @@
 char *(*pfn) = (char *(*)) realloc
 ; return 0; }
 EOF
-if { (eval echo configure:7934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_realloc=no
 else
@@ -7951,12 +7915,12 @@
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:7955: checking whether free must be declared" >&5
+echo "configure:7919: checking whether free must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7960 "configure"
+#line 7924 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7977,7 +7941,7 @@
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:7981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -7998,12 +7962,12 @@
 fi
 
 echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6
-echo "configure:8002: checking whether strerror must be declared" >&5
+echo "configure:7966: checking whether strerror must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8007 "configure"
+#line 7971 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -8024,7 +7988,7 @@
 char *(*pfn) = (char *(*)) strerror
 ; return 0; }
 EOF
-if { (eval echo configure:8028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strerror=no
 else
@@ -8045,12 +8009,12 @@
 fi
 
 echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6
-echo "configure:8049: checking whether strdup must be declared" >&5
+echo "configure:8013: checking whether strdup must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8054 "configure"
+#line 8018 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -8071,7 +8035,7 @@
 char *(*pfn) = (char *(*)) strdup
 ; return 0; }
 EOF
-if { (eval echo configure:8075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8039: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strdup=no
 else
@@ -8092,12 +8056,12 @@
 fi
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:8096: checking whether strstr must be declared" >&5
+echo "configure:8060: checking whether strstr must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8101 "configure"
+#line 8065 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -8118,7 +8082,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:8122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -8139,12 +8103,12 @@
 fi
 
 echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
-echo "configure:8143: checking whether canonicalize_file_name must be declared" >&5
+echo "configure:8107: checking whether canonicalize_file_name must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8148 "configure"
+#line 8112 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -8165,7 +8129,7 @@
 char *(*pfn) = (char *(*)) canonicalize_file_name
 ; return 0; }
 EOF
-if { (eval echo configure:8169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_canonicalize_file_name=no
 else
@@ -8191,9 +8155,9 @@
 # could be expunged. --jsm 1999-03-22
 
 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6
-echo "configure:8195: checking for HPUX save_state structure" >&5
+echo "configure:8159: checking for HPUX save_state structure" >&5
 cat > conftest.$ac_ext <<EOF
-#line 8197 "configure"
+#line 8161 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -8208,7 +8172,7 @@
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 8212 "configure"
+#line 8176 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -8285,12 +8249,12 @@
 
 if test "$ac_cv_header_sys_procfs_h" = yes; then
   echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8289: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:8253: checking for pstatus_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8294 "configure"
+#line 8258 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8299,7 +8263,7 @@
 pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pstatus_t=yes
 else
@@ -8321,12 +8285,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
 
   echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8325: checking for prrun_t in sys/procfs.h" >&5
+echo "configure:8289: checking for prrun_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8330 "configure"
+#line 8294 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8335,7 +8299,7 @@
 prrun_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prrun_t=yes
 else
@@ -8357,12 +8321,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6
 
   echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8361: checking for gregset_t in sys/procfs.h" >&5
+echo "configure:8325: checking for gregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8366 "configure"
+#line 8330 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8371,7 +8335,7 @@
 gregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_gregset_t=yes
 else
@@ -8393,12 +8357,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6
 
   echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8397: checking for fpregset_t in sys/procfs.h" >&5
+echo "configure:8361: checking for fpregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8402 "configure"
+#line 8366 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8407,7 +8371,7 @@
 fpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_fpregset_t=yes
 else
@@ -8429,12 +8393,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6
 
   echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8433: checking for prgregset_t in sys/procfs.h" >&5
+echo "configure:8397: checking for prgregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8438 "configure"
+#line 8402 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8443,7 +8407,7 @@
 prgregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prgregset_t=yes
 else
@@ -8465,12 +8429,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6
 
   echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8469: checking for prfpregset_t in sys/procfs.h" >&5
+echo "configure:8433: checking for prfpregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8474 "configure"
+#line 8438 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8479,7 +8443,7 @@
 prfpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prfpregset_t=yes
 else
@@ -8501,12 +8465,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6
 
   echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8505: checking for prgregset32_t in sys/procfs.h" >&5
+echo "configure:8469: checking for prgregset32_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8510 "configure"
+#line 8474 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8515,7 +8479,7 @@
 prgregset32_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prgregset32_t=yes
 else
@@ -8537,12 +8501,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6
 
   echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8541: checking for prfpregset32_t in sys/procfs.h" >&5
+echo "configure:8505: checking for prfpregset32_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8546 "configure"
+#line 8510 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8551,7 +8515,7 @@
 prfpregset32_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prfpregset32_t=yes
 else
@@ -8573,12 +8537,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6
 
   echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8577: checking for lwpid_t in sys/procfs.h" >&5
+echo "configure:8541: checking for lwpid_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8582 "configure"
+#line 8546 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8587,7 +8551,7 @@
 lwpid_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_lwpid_t=yes
 else
@@ -8609,12 +8573,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6
 
   echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8613: checking for psaddr_t in sys/procfs.h" >&5
+echo "configure:8577: checking for psaddr_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8618 "configure"
+#line 8582 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8623,7 +8587,7 @@
 psaddr_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_psaddr_t=yes
 else
@@ -8645,12 +8609,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6
 
   echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8649: checking for prsysent_t in sys/procfs.h" >&5
+echo "configure:8613: checking for prsysent_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8654 "configure"
+#line 8618 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8659,7 +8623,7 @@
 prsysent_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prsysent_t=yes
 else
@@ -8681,12 +8645,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6
 
   echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8685: checking for pr_sigset_t in sys/procfs.h" >&5
+echo "configure:8649: checking for pr_sigset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8690 "configure"
+#line 8654 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8695,7 +8659,7 @@
 pr_sigset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_sigset_t=yes
 else
@@ -8717,12 +8681,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6
 
   echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8721: checking for pr_sigaction64_t in sys/procfs.h" >&5
+echo "configure:8685: checking for pr_sigaction64_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8726 "configure"
+#line 8690 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8731,7 +8695,7 @@
 pr_sigaction64_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes
 else
@@ -8753,12 +8717,12 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6
 
   echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8757: checking for pr_siginfo64_t in sys/procfs.h" >&5
+echo "configure:8721: checking for pr_siginfo64_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8762 "configure"
+#line 8726 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -8767,7 +8731,7 @@
 pr_siginfo64_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:8771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes
 else
@@ -8794,7 +8758,7 @@
         
   if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
     echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6
-echo "configure:8798: checking whether prfpregset_t type is broken" >&5
+echo "configure:8762: checking whether prfpregset_t type is broken" >&5
     if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8802,7 +8766,7 @@
   gdb_cv_prfpregset_t_broken=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 8806 "configure"
+#line 8770 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
        int main ()
@@ -8812,7 +8776,7 @@
          return 0;
        }
 EOF
-if { (eval echo configure:8816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_prfpregset_t_broken=no
 else
@@ -8837,12 +8801,12 @@
 
   
   echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:8841: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
+echo "configure:8805: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8846 "configure"
+#line 8810 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 #include <sys/types.h>
@@ -8855,7 +8819,7 @@
   
 ; return 0; }
 EOF
-if { (eval echo configure:8859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8823: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_procfs_piocset=yes
 else
@@ -8879,19 +8843,19 @@
 if test ${host} = ${target} ; then
     
   echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:8883: checking for member l_addr in struct link_map" >&5
+echo "configure:8847: checking for member l_addr in struct link_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8888 "configure"
+#line 8852 "configure"
 #include "confdefs.h"
 #include <link.h>
 int main() {
 struct link_map lm; (void) lm.l_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:8895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map_with_l_members=yes
 else
@@ -8913,12 +8877,12 @@
 
     
   echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:8917: checking for member lm_addr in struct link_map" >&5
+echo "configure:8881: checking for member lm_addr in struct link_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8922 "configure"
+#line 8886 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <link.h>
@@ -8926,7 +8890,7 @@
 struct link_map lm; (void) lm.lm_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:8930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map_with_lm_members=yes
 else
@@ -8948,12 +8912,12 @@
 
     
   echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6
-echo "configure:8952: checking for member som_addr in struct so_map" >&5
+echo "configure:8916: checking for member som_addr in struct so_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8957 "configure"
+#line 8921 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_NLIST_H
@@ -8964,7 +8928,7 @@
 struct so_map lm; (void) lm.som_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:8968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_so_map_with_som_members=yes
 else
@@ -8986,12 +8950,12 @@
 
     
   echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6
-echo "configure:8990: checking for struct link_map32 in sys/link.h" >&5
+echo "configure:8954: checking for struct link_map32 in sys/link.h" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8995 "configure"
+#line 8959 "configure"
 #include "confdefs.h"
 #define _SYSCALL32
 #include <sys/link.h>
@@ -8999,7 +8963,7 @@
 struct link_map32 l;
 ; return 0; }
 EOF
-if { (eval echo configure:9003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map32=yes
 else
@@ -9026,12 +8990,12 @@
 
 
 echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6
-echo "configure:9030: checking for long long support in compiler" >&5
+echo "configure:8994: checking for long long support in compiler" >&5
 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9035 "configure"
+#line 8999 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -9041,7 +9005,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_c_long_long=yes
 else
@@ -9063,7 +9027,7 @@
 
 
 echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6
-echo "configure:9067: checking for long long support in printf" >&5
+echo "configure:9031: checking for long long support in printf" >&5
 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9071,7 +9035,7 @@
   gdb_cv_printf_has_long_long=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 9075 "configure"
+#line 9039 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -9085,7 +9049,7 @@
   return (strcmp ("0x0123456789abcdef", buf));
 }
 EOF
-if { (eval echo configure:9089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_printf_has_long_long=yes
 else
@@ -9109,19 +9073,19 @@
 
 
 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6
-echo "configure:9113: checking for long double support in compiler" >&5
+echo "configure:9077: checking for long double support in compiler" >&5
 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9118 "configure"
+#line 9082 "configure"
 #include "confdefs.h"
 
 int main() {
 long double foo;
 ; return 0; }
 EOF
-if { (eval echo configure:9125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_long_double=yes
 else
@@ -9143,7 +9107,7 @@
 
 
 echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6
-echo "configure:9147: checking for long double support in printf" >&5
+echo "configure:9111: checking for long double support in printf" >&5
 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9151,7 +9115,7 @@
   gdb_cv_printf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 9155 "configure"
+#line 9119 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -9161,7 +9125,7 @@
   return (strncmp ("3.14159", buf, 7));
 }
 EOF
-if { (eval echo configure:9165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_printf_has_long_double=yes
 else
@@ -9185,7 +9149,7 @@
 
 
 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6
-echo "configure:9189: checking for long double support in scanf" >&5
+echo "configure:9153: checking for long double support in scanf" >&5
 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9193,7 +9157,7 @@
   gdb_cv_scanf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 9197 "configure"
+#line 9161 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -9203,7 +9167,7 @@
   return !(f > 3.14159 && f < 3.14160);
 }
 EOF
-if { (eval echo configure:9207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_scanf_has_long_double=yes
 else
@@ -9228,7 +9192,7 @@
 case ${host_os} in
 aix*)
   echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6
-echo "configure:9232: checking for -bbigtoc option" >&5
+echo "configure:9196: checking for -bbigtoc option" >&5
 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9242,14 +9206,14 @@
 
     LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
     cat > conftest.$ac_ext <<EOF
-#line 9246 "configure"
+#line 9210 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:9253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -9273,7 +9237,7 @@
    case ${host_os} in
    hpux*)
       echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6
-echo "configure:9277: checking for HPUX/OSF thread support" >&5
+echo "configure:9241: checking for HPUX/OSF thread support" >&5
       if test -f /usr/include/dce/cma_config.h ; then
          if test "$GCC" = "yes" ; then
             echo "$ac_t""yes" 1>&6
@@ -9296,7 +9260,7 @@
       # because version 0 (present on Solaris 2.4 or earlier) doesn't have
       # the same API.
       echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6
-echo "configure:9300: checking for Solaris thread debugging library" >&5
+echo "configure:9264: checking for Solaris thread debugging library" >&5
       if test -f /usr/lib/libthread_db.so.1 ; then
          echo "$ac_t""yes" 1>&6
          cat >> confdefs.h <<\EOF
@@ -9306,7 +9270,7 @@
          CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
          CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
          echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:9310: checking for dlopen in -ldl" >&5
+echo "configure:9274: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -9314,7 +9278,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9318 "configure"
+#line 9282 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -9325,7 +9289,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:9329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9357,17 +9321,17 @@
             # all symbols visible in the dynamic symbol table.
             hold_ldflags=$LDFLAGS
             echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:9361: checking for the ld -export-dynamic flag" >&5
+echo "configure:9325: checking for the ld -export-dynamic flag" >&5
             LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
             cat > conftest.$ac_ext <<EOF
-#line 9364 "configure"
+#line 9328 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:9371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   found=yes
 else
@@ -9386,13 +9350,13 @@
 	 # Sun randomly tweaked the prototypes in <proc_service.h>
 	 # at one point.
 	 echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6
-echo "configure:9390: checking if <proc_service.h> is old" >&5
+echo "configure:9354: checking if <proc_service.h> is old" >&5
 	 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	    cat > conftest.$ac_ext <<EOF
-#line 9396 "configure"
+#line 9360 "configure"
 #include "confdefs.h"
 
 		#include <proc_service.h>
@@ -9403,7 +9367,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_proc_service_is_old=no
 else
@@ -9429,12 +9393,12 @@
       ;;
    aix*)
       echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6
-echo "configure:9433: checking for AiX thread debugging library" >&5
+echo "configure:9397: checking for AiX thread debugging library" >&5
       if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9438 "configure"
+#line 9402 "configure"
 #include "confdefs.h"
 #include <sys/pthdebug.h>
 int main() {
@@ -9443,7 +9407,7 @@
                                     #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_aix_thread_debug=yes
 else
@@ -9468,19 +9432,19 @@
 
 if test "x$ac_cv_header_thread_db_h" = "xyes"; then
    echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6
-echo "configure:9472: checking whether <thread_db.h> has TD_NOTALLOC" >&5
+echo "configure:9436: checking whether <thread_db.h> has TD_NOTALLOC" >&5
 if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9477 "configure"
+#line 9441 "configure"
 #include "confdefs.h"
 #include <thread_db.h>
 int main() {
 int i = TD_NOTALLOC;
 ; return 0; }
 EOF
-if { (eval echo configure:9484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_thread_db_h_has_td_notalloc=yes
 else
@@ -9505,19 +9469,19 @@
 
 if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
    echo $ac_n "checking whether <sys/syscall.h> has __NR_tkill""... $ac_c" 1>&6
-echo "configure:9509: checking whether <sys/syscall.h> has __NR_tkill" >&5
+echo "configure:9473: checking whether <sys/syscall.h> has __NR_tkill" >&5
 if eval "test \"`echo '$''{'gdb_cv_sys_syscall_h_has_tkill'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9514 "configure"
+#line 9478 "configure"
 #include "confdefs.h"
 #include <sys/syscall.h>
 int main() {
 int i = __NR_tkill;
 ; return 0; }
 EOF
-if { (eval echo configure:9521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_sys_syscall_h_has_tkill=yes
 else
@@ -9629,7 +9593,7 @@
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
 then
     echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6
-echo "configure:9633: checking compiler warning flags" >&5
+echo "configure:9597: checking compiler warning flags" >&5
     # Separate out the -Werror flag as some files just cannot be
     # compiled with it enabled.
     for w in ${build_warnings}; do
@@ -9639,14 +9603,14 @@
 	    saved_CFLAGS="$CFLAGS"
 	    CFLAGS="$CFLAGS $w"
 	    cat > conftest.$ac_ext <<EOF
-#line 9643 "configure"
+#line 9607 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:9650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   WARN_CFLAGS="${WARN_CFLAGS} $w"
 else
@@ -9664,12 +9628,12 @@
 
 # In the Cygwin environment, we need some additional flags.
 echo $ac_n "checking for cygwin""... $ac_c" 1>&6
-echo "configure:9668: checking for cygwin" >&5
+echo "configure:9632: checking for cygwin" >&5
 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9673 "configure"
+#line 9637 "configure"
 #include "confdefs.h"
 
 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
@@ -9754,7 +9718,7 @@
 fi
 
   echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:9758: checking for Tcl configuration" >&5
+echo "configure:9722: checking for Tcl configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9863,7 +9827,7 @@
 fi
 
   echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6
-echo "configure:9867: checking for Tk configuration" >&5
+echo "configure:9831: checking for Tk configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9965,7 +9929,7 @@
 
 no_tcl=true
 echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6
-echo "configure:9969: checking for Tcl private headers. dir=${configdir}" >&5
+echo "configure:9933: checking for Tcl private headers. dir=${configdir}" >&5
 # Check whether --with-tclinclude or --without-tclinclude was given.
 if test "${with_tclinclude+set}" = set; then
   withval="$with_tclinclude"
@@ -10031,17 +9995,17 @@
 if test x"${ac_cv_c_tclh}" = x ; then
    ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6
-echo "configure:10035: checking for tclInt.h" >&5
+echo "configure:9999: checking for tclInt.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10040 "configure"
+#line 10004 "configure"
 #include "confdefs.h"
 #include <tclInt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10101,7 +10065,7 @@
 #
 no_tk=true
 echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6
-echo "configure:10105: checking for Tk private headers" >&5
+echo "configure:10069: checking for Tk private headers" >&5
 # Check whether --with-tkinclude or --without-tkinclude was given.
 if test "${with_tkinclude+set}" = set; then
   withval="$with_tkinclude"
@@ -10167,17 +10131,17 @@
 if test x"${ac_cv_c_tkh}" = x ; then
    ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for tk.h""... $ac_c" 1>&6
-echo "configure:10171: checking for tk.h" >&5
+echo "configure:10135: checking for tk.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10176 "configure"
+#line 10140 "configure"
 #include "confdefs.h"
 #include <tk.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10223,7 +10187,7 @@
 
 	   
 echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:10227: checking for Itcl private headers. srcdir=${srcdir}" >&5
+echo "configure:10191: checking for Itcl private headers. srcdir=${srcdir}" >&5
 if test x"${ac_cv_c_itclh}" = x ; then
   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
     if test -f $i/generic/itcl.h ; then
@@ -10246,7 +10210,7 @@
 
 	   
 echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:10250: checking for Itk private headers. srcdir=${srcdir}" >&5
+echo "configure:10214: checking for Itk private headers. srcdir=${srcdir}" >&5
 if test x"${ac_cv_c_itkh}" = x ; then
   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
     if test -f $i/generic/itk.h ; then
@@ -10294,7 +10258,7 @@
 fi
 
   echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6
-echo "configure:10298: checking for Itcl configuration" >&5
+echo "configure:10262: checking for Itcl configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10397,7 +10361,7 @@
 fi
 
   echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6
-echo "configure:10401: checking for Itk configuration" >&5
+echo "configure:10365: checking for Itk configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10539,7 +10503,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:10543: checking for X" >&5
+echo "configure:10507: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -10601,12 +10565,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 10605 "configure"
+#line 10569 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10675,14 +10639,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 10679 "configure"
+#line 10643 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:10686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -10769,26 +10733,7 @@
 fi
 
 
-# Check whether we should enable the TUI, but only do so if we really
-# can.
-if test x"$enable_tui" = xyes; then
-  if test -d $srcdir/tui; then
-    if test "$ac_cv_search_waddstr" != no; then
-      CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
-      CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
-      CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
-      CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
-      ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
-      CONFIG_ALL="${CONFIG_ALL} all-tui"
-      CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
-      CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
-      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
-    else
-      echo "configure: warning: no enhanced curses library found; disabling TUI" 1>&2
-    fi
-  fi
-fi
-
+ 
 # Unlike the sim directory, whether a simulator is linked is controlled by 
 # presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.  
 # This code just checks for a few cases where we'd like to ignore those
@@ -10862,19 +10807,22 @@
 
 
 frags=
-if test "${target}" = "${host}"; then
-  host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
-  if test ! -f ${host_makefile_frag}; then
-    { echo "configure: error: "*** Gdb does not support native target ${host}"" 1>&2; exit 1; }
-  fi
-  frags="$frags $host_makefile_frag"
-else
-  host_makefile_frag=/dev/null
+host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
+if test ! -f ${host_makefile_frag}; then
+    # When building a native debuger the .mh file containing things
+    # like NATDEPFILES is needed.  Cross debuggers don't need .mh
+    # since it no longer contains anything useful.
+    if test "${target}" = "${host}"; then
+	{ echo "configure: error: "*** Gdb does not support native target ${host}"" 1>&2; exit 1; }
+    else
+	host_makefile_frag=/dev/null
+    fi
 fi
+frags="$frags $host_makefile_frag"
 
 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
 if test ! -f ${target_makefile_frag}; then
-  { echo "configure: error: "*** Gdb does not support target ${target}"" 1>&2; exit 1; }
+{ echo "configure: error: "*** Gdb does not support target ${target}"" 1>&2; exit 1; }
 fi
 frags="$frags $target_makefile_frag"
 
@@ -10924,7 +10872,7 @@
 # We only build gdbserver automatically if host and target are the same.
 if test "x$target" = "x$host"; then
   echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6
-echo "configure:10928: checking whether gdbserver is supported on this host" >&5
+echo "configure:10876: checking whether gdbserver is supported on this host" >&5
   if test "x$build_gdbserver" = xyes; then
     configdirs="$configdirs gdbserver"
     echo "$ac_t""yes" 1>&6
@@ -10997,12 +10945,12 @@
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:11001: checking for Cygwin environment" >&5
+echo "configure:10949: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11006 "configure"
+#line 10954 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -11013,7 +10961,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:11017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -11030,19 +10978,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:11034: checking for mingw32 environment" >&5
+echo "configure:10982: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11039 "configure"
+#line 10987 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:11046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -11061,7 +11009,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:11065: checking for executable suffix" >&5
+echo "configure:11013: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11071,7 +11019,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:11075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:11023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -11113,7 +11061,7 @@
 
 
   echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:11117: checking for iconv" >&5
+echo "configure:11065: checking for iconv" >&5
 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11121,7 +11069,7 @@
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     cat > conftest.$ac_ext <<EOF
-#line 11125 "configure"
+#line 11073 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -11131,7 +11079,7 @@
        iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:11135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_func_iconv=yes
 else
@@ -11143,7 +11091,7 @@
       am_save_LIBS="$LIBS"
       LIBS="$LIBS -liconv"
       cat > conftest.$ac_ext <<EOF
-#line 11147 "configure"
+#line 11095 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -11153,7 +11101,7 @@
          iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:11157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_lib_iconv=yes
         am_cv_func_iconv=yes
@@ -11174,13 +11122,13 @@
 EOF
 
     echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:11178: checking for iconv declaration" >&5
+echo "configure:11126: checking for iconv declaration" >&5
     if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
       cat > conftest.$ac_ext <<EOF
-#line 11184 "configure"
+#line 11132 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -11199,7 +11147,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:11203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_proto_iconv_arg1=""
 else
@@ -11761,6 +11709,14 @@
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 
+if test "${nativefile}" = ""; then
+        < Makefile \
+        sed -e '/^NATDEPFILES[ 	]*=.*\\$/,/[^\\]$/s/^/# /' \
+            -e '/^NATDEPFILES[ 	]*=/s/^/# /' \
+        | sed -e '/^\(NATDEPFILES[ 	]*[+]=[ 	]*\)/s//# \1/' \
+	> Makefile.tem
+mv -f Makefile.tem Makefile
+fi
 
 sed -e '/^DEPRECATED_TM_FILE[ 	]*=/s,^DEPRECATED_TM_FILE[ 	]*=[ 	]*,&config/'"${gdb_target_cpu}"'/,
 /^XM_FILE[ 	]*=/s,^XM_FILE[ 	]*=[ 	]*,&config/'"${gdb_host_cpu}"'/,
diff --git a/gdb/configure.in b/gdb/configure.in
index fad4362..d3dc041 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -193,6 +193,21 @@
     *)
       AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
   esac],enable_tui=yes)
+if test x"$enable_tui" = xyes; then
+  if test -d $srcdir/tui; then
+    if test "$ac_cv_search_mvwaddstr" != no; then
+      CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
+      CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
+      CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
+      CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
+      ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
+      CONFIG_ALL="${CONFIG_ALL} all-tui"
+      CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
+      CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
+      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
+    fi
+  fi
+fi
 
 # Enable gdbtk.
 AC_ARG_ENABLE(gdbtk,
@@ -326,7 +341,11 @@
 # search /usr/local/include, if ncurses is installed in /usr/local.  A
 # default installation of ncurses on alpha*-dec-osf* will lead to such
 # a situation.
-AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
+AC_SEARCH_LIBS(mvwaddstr, [ncurses cursesX curses])
+
+if test "$ac_cv_search_mvwaddstr" = no; then
+  AC_MSG_WARN([no curses library found])
+fi
 
 # Since GDB uses Readline, we need termcap functionality.  In many
 # cases this will be provided by the curses library, but some systems
@@ -448,7 +467,6 @@
 AC_CHECK_FUNCS(socketpair)
 AC_CHECK_FUNCS(syscall)
 AC_CHECK_FUNCS(ttrace)
-AC_CHECK_FUNCS(wborder)
 
 # Check the return and argument types of ptrace.  No canned test for
 # this, so roll our own.
@@ -1345,26 +1363,7 @@
 
 AC_PATH_X
 
-# Check whether we should enable the TUI, but only do so if we really
-# can.
-if test x"$enable_tui" = xyes; then
-  if test -d $srcdir/tui; then
-    if test "$ac_cv_search_waddstr" != no; then
-      CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
-      CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
-      CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
-      CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
-      ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
-      CONFIG_ALL="${CONFIG_ALL} all-tui"
-      CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
-      CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
-      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
-    else
-      AC_MSG_WARN([no enhanced curses library found; disabling TUI])
-    fi
-  fi
-fi
-
+ 
 # Unlike the sim directory, whether a simulator is linked is controlled by 
 # presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.  
 # This code just checks for a few cases where we'd like to ignore those
@@ -1422,19 +1421,22 @@
 AC_SUBST(target_subdir)
 
 frags=
-if test "${target}" = "${host}"; then
-  host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
-  if test ! -f ${host_makefile_frag}; then
-    AC_MSG_ERROR("*** Gdb does not support native target ${host}")
-  fi
-  frags="$frags $host_makefile_frag"
-else
-  host_makefile_frag=/dev/null
+host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
+if test ! -f ${host_makefile_frag}; then
+    # When building a native debuger the .mh file containing things
+    # like NATDEPFILES is needed.  Cross debuggers don't need .mh
+    # since it no longer contains anything useful.
+    if test "${target}" = "${host}"; then
+	AC_MSG_ERROR("*** Gdb does not support native target ${host}")
+    else
+	host_makefile_frag=/dev/null
+    fi
 fi
+frags="$frags $host_makefile_frag"
 
 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
 if test ! -f ${target_makefile_frag}; then
-  AC_MSG_ERROR("*** Gdb does not support target ${target}")
+AC_MSG_ERROR("*** Gdb does not support target ${target}")
 fi
 frags="$frags $target_makefile_frag"
 
@@ -1561,6 +1563,14 @@
 dnl Autoconf doesn't provide a mechanism for modifying definitions 
 dnl provided by makefile fragments.
 dnl
+if test "${nativefile}" = ""; then
+        < Makefile \
+        sed -e '/^NATDEPFILES[[ 	]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
+            -e '/^NATDEPFILES[[ 	]]*=/s/^/# /' \
+        | sed -e '/^\(NATDEPFILES[[ 	]]*[[+]]=[[ 	]]*\)/s//# \1/' \
+	> Makefile.tem
+mv -f Makefile.tem Makefile
+fi
 
 changequote(,)dnl
 sed -e '/^DEPRECATED_TM_FILE[ 	]*=/s,^DEPRECATED_TM_FILE[ 	]*=[ 	]*,&config/'"${gdb_target_cpu}"'/,
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 0b1f627..a7c14d8 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -106,8 +106,7 @@
 			;;
 ia64*-*-*)		gdb_target=ia64 ;;
 
-m32r*-*-linux*)		gdb_target=linux ;;
-m32r*-*-*)		gdb_target=m32r ;;
+m32r-*-*)		gdb_target=m32r ;;
 
 m68hc11*-*-*|m6811*-*-*)	gdb_target=m68hc11 ;;
 
@@ -188,7 +187,9 @@
 sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
 			gdb_target=nbsd64 ;;
 sparc-*-openbsd*)	gdb_target=obsd ;;
-sparc64-*-openbsd*)	gdb_target=obsd64 ;;
+sparc64-*-openbsd*)	gdb_target=obsd64
+			gdb_osabi=GDB_OSABI_OPENBSD_ELF
+			;;
 sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
 			gdb_target=sol2
 			;;
@@ -219,7 +220,9 @@
 			;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 			gdb_target=nbsd64 ;;
-x86_64-*-openbsd*)	gdb_target=obsd64 ;;
+x86_64-*-openbsd*)	gdb_target=obsd64
+			gdb_osabi=GDB_OSABI_OPENBSD_ELF
+			;;
 
 esac
 
@@ -228,8 +231,6 @@
 case "${target}" in
 *-*-linux*)	gdb_osabi=GDB_OSABI_LINUX ;;
 *-*-nto*)	gdb_osabi=GDB_OSABI_QNXNTO ;;
-m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
-*-*-openbsd*)	gdb_osabi=GDB_OSABI_OPENBSD_ELF ;;
 *-*-solaris*)	gdb_osabi=GDB_OSABI_SOLARIS ;;
 *-*-*-gnu*)	;; # prevent non-GNU kernels to match the Hurd rule below
 *-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
diff --git a/gdb/corelow.c b/gdb/corelow.c
index f91ec59..a9d2132 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -538,11 +538,11 @@
     {
     case TARGET_OBJECT_MEMORY:
       if (readbuf)
-	return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-					       0/*write*/, NULL, ops);
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+				       NULL, ops);
       if (writebuf)
-	return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-					       1/*write*/, NULL, ops);
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+				       NULL, ops);
       return -1;
 
     case TARGET_OBJECT_AUXV:
@@ -655,7 +655,7 @@
   core_ops.to_detach = core_detach;
   core_ops.to_fetch_registers = get_core_registers;
   core_ops.to_xfer_partial = core_xfer_partial;
-  core_ops.deprecated_xfer_memory = xfer_memory;
+  core_ops.to_xfer_memory = xfer_memory;
   core_ops.to_files_info = core_files_info;
   core_ops.to_insert_breakpoint = ignore;
   core_ops.to_remove_breakpoint = ignore;
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 64f1e5f..1cb0d52 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -42,11 +42,12 @@
 /* To get entry_point_address.  */
 #include "objfiles.h"
 
-#include "solib.h"              /* Support for shared libraries.  */
+#include "solib.h"              /* Support for shared libraries. */
 #include "solib-svr4.h"         /* For struct link_map_offsets.  */
 #include "gdb_string.h"
 #include "dis-asm.h"
 
+
 enum cris_num_regs
 {
   /* There are no floating point registers.  Used in gdbserver low-linux.c.  */
@@ -107,19 +108,32 @@
 
 /* CRIS version, set via the user command 'set cris-version'.  Affects
    register names and sizes.*/
-static unsigned int usr_cmd_cris_version;
+static int usr_cmd_cris_version;
 
 /* Indicates whether to trust the above variable.  */
 static int usr_cmd_cris_version_valid = 0;
 
-/* Whether to make use of Dwarf-2 CFI (default on).  */
-static int usr_cmd_cris_dwarf2_cfi = 1;
+/* CRIS mode, set via the user command 'set cris-mode'.  Affects availability
+   of some registers.  */
+static const char *usr_cmd_cris_mode;
+
+/* Indicates whether to trust the above variable.  */
+static int usr_cmd_cris_mode_valid = 0;
+
+static const char CRIS_MODE_USER[] = "CRIS_MODE_USER";
+static const char CRIS_MODE_SUPERVISOR[] = "CRIS_MODE_SUPERVISOR";
+static const char *cris_mode_enums[] = 
+{
+  CRIS_MODE_USER,
+  CRIS_MODE_SUPERVISOR,
+  0
+};
 
 /* CRIS architecture specific information.  */
 struct gdbarch_tdep
 {
-  unsigned int cris_version;
-  int cris_dwarf2_cfi;
+  int cris_version;
+  const char *cris_mode;
 };
 
 /* Functions for accessing target dependent data.  */
@@ -130,121 +144,10 @@
   return (gdbarch_tdep (current_gdbarch)->cris_version);
 }
 
-/* Sigtramp identification code copied from i386-linux-tdep.c.  */
-
-#define SIGTRAMP_INSN0    0x9c5f  /* movu.w 0xXX, $r9 */
-#define SIGTRAMP_OFFSET0  0
-#define SIGTRAMP_INSN1    0xe93d  /* break 13 */
-#define SIGTRAMP_OFFSET1  4
-
-static const unsigned short sigtramp_code[] =
+static const char *
+cris_mode (void)
 {
-  SIGTRAMP_INSN0, 0x0077,  /* movu.w $0x77, $r9 */
-  SIGTRAMP_INSN1           /* break 13 */
-};
-
-#define SIGTRAMP_LEN (sizeof sigtramp_code)
-
-/* Note: same length as normal sigtramp code.  */
-
-static const unsigned short rt_sigtramp_code[] =
-{
-  SIGTRAMP_INSN0, 0x00ad,  /* movu.w $0xad, $r9 */
-  SIGTRAMP_INSN1           /* break 13 */
-};
-
-/* If PC is in a sigtramp routine, return the address of the start of
-   the routine.  Otherwise, return 0.  */
-
-static CORE_ADDR
-cris_sigtramp_start (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  unsigned short buf[SIGTRAMP_LEN];
-
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
-    return 0;
-
-  if (buf[0] != SIGTRAMP_INSN0)
-    {
-      if (buf[0] != SIGTRAMP_INSN1)
-	return 0;
-
-      pc -= SIGTRAMP_OFFSET1;
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
-	return 0;
-    }
-
-  if (memcmp (buf, sigtramp_code, SIGTRAMP_LEN) != 0)
-    return 0;
-
-  return pc;
-}
-
-/* If PC is in a RT sigtramp routine, return the address of the start of
-   the routine.  Otherwise, return 0.  */
-
-static CORE_ADDR
-cris_rt_sigtramp_start (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  unsigned short buf[SIGTRAMP_LEN];
-
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
-    return 0;
-
-  if (buf[0] != SIGTRAMP_INSN0)
-    {
-      if (buf[0] != SIGTRAMP_INSN1)
-	return 0;
-
-      pc -= SIGTRAMP_OFFSET1;
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
-	return 0;
-    }
-
-  if (memcmp (buf, rt_sigtramp_code, SIGTRAMP_LEN) != 0)
-    return 0;
-
-  return pc;
-}
-
-/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
-   routine, return the address of the associated sigcontext structure.  */
-
-static CORE_ADDR
-cris_sigcontext_addr (struct frame_info *next_frame)
-{
-  CORE_ADDR pc;
-  CORE_ADDR sp;
-  char buf[4];
-
-  frame_unwind_register (next_frame, SP_REGNUM, buf);
-  sp = extract_unsigned_integer (buf, 4);
-
-  /* Look for normal sigtramp frame first.  */
-  pc = cris_sigtramp_start (next_frame);
-  if (pc)
-    {
-      /* struct signal_frame (arch/cris/kernel/signal.c) contains
-	 struct sigcontext as its first member, meaning the SP points to
-	 it already.  */
-      return sp;
-    }
-
-  pc = cris_rt_sigtramp_start (next_frame);
-  if (pc)
-    {
-      /* struct rt_signal_frame (arch/cris/kernel/signal.c) contains
-	 a struct ucontext, which in turn contains a struct sigcontext.
-	 Magic digging:
-	 4 + 4 + 128 to struct ucontext, then
-	 4 + 4 + 12 to struct sigcontext.  */
-      return (sp + 156);
-    }
-
-  error ("Couldn't recognize signal trampoline.");
-  return 0;
+  return (gdbarch_tdep (current_gdbarch)->cris_mode);
 }
 
 struct cris_unwind_cache
@@ -270,111 +173,6 @@
   struct trad_frame_saved_reg *saved_regs;
 };
 
-static struct cris_unwind_cache *
-cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
-				  void **this_cache)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  struct cris_unwind_cache *info;
-  CORE_ADDR pc;
-  CORE_ADDR sp;
-  CORE_ADDR addr;
-  char buf[4];
-  int i;
-
-  if ((*this_cache))
-    return (*this_cache);
-
-  info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
-  (*this_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
-  /* Zero all fields.  */
-  info->prev_sp = 0;
-  info->base = 0;
-  info->size = 0;
-  info->sp_offset = 0;
-  info->r8_offset = 0;
-  info->uses_frame = 0;
-  info->return_pc = 0;
-  info->leaf_function = 0;
-
-  frame_unwind_register (next_frame, SP_REGNUM, buf);
-  info->base = extract_unsigned_integer (buf, 4);
-
-  addr = cris_sigcontext_addr (next_frame);
-  
-  /* Layout of the sigcontext struct:
-     struct sigcontext {
-	struct pt_regs regs;
-	unsigned long oldmask;
-	unsigned long usp;
-     }; */
-  
-  /* R0 to R13 are stored in reverse order at offset (2 * 4) in 
-     struct pt_regs.  */
-  for (i = 0; i <= 13; i++)
-    info->saved_regs[i].addr = addr + ((15 - i) * 4);
-
-  info->saved_regs[MOF_REGNUM].addr = addr + (16 * 4);
-  info->saved_regs[DCCR_REGNUM].addr = addr + (17 * 4);
-  info->saved_regs[SRP_REGNUM].addr = addr + (18 * 4);
-  /* Note: IRP is off by 2 at this point.  There's no point in correcting it
-     though since that will mean that the backtrace will show a PC different
-     from what is shown when stopped.  */
-  info->saved_regs[IRP_REGNUM].addr = addr + (19 * 4);
-  info->saved_regs[PC_REGNUM] = info->saved_regs[IRP_REGNUM];
-  info->saved_regs[SP_REGNUM].addr = addr + (24 * 4);
-  
-  return info;
-}
-
-static void
-cris_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
-                             struct frame_id *this_id)
-{
-  struct cris_unwind_cache *cache =
-    cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
-  (*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame));
-}
-
-/* Forward declaration.  */
-
-static void cris_frame_prev_register (struct frame_info *next_frame,
-				      void **this_prologue_cache,
-				      int regnum, int *optimizedp,
-				      enum lval_type *lvalp, CORE_ADDR *addrp,
-				      int *realnump, void *bufferp);
-static void
-cris_sigtramp_frame_prev_register (struct frame_info *next_frame,
-                                   void **this_cache,
-                                   int regnum, int *optimizedp,
-                                   enum lval_type *lvalp, CORE_ADDR *addrp,
-                                   int *realnump, void *valuep)
-{
-  /* Make sure we've initialized the cache.  */
-  cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
-  cris_frame_prev_register (next_frame, this_cache, regnum,
-                            optimizedp, lvalp, addrp, realnump, valuep);
-}
-
-static const struct frame_unwind cris_sigtramp_frame_unwind =
-{
-  SIGTRAMP_FRAME,
-  cris_sigtramp_frame_this_id,
-  cris_sigtramp_frame_prev_register
-};
-
-static const struct frame_unwind *
-cris_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  if (cris_sigtramp_start (next_frame) 
-      || cris_rt_sigtramp_start (next_frame))
-    return &cris_sigtramp_frame_unwind;
-
-  return NULL;
-}
-
 /* The instruction environment needed to find single-step breakpoints.  */
 typedef 
 struct instruction_environment
@@ -547,11 +345,11 @@
 
 static void cris_dump_tdep (struct gdbarch *, struct ui_file *);
 
-static void set_cris_version (char *ignore_args, int from_tty, 
-			      struct cmd_list_element *c);
+static void cris_version_update (char *ignore_args, int from_tty, 
+                                 struct cmd_list_element *c);
 
-static void set_cris_dwarf2_cfi (char *ignore_args, int from_tty, 
-				 struct cmd_list_element *c);
+static void cris_mode_update (char *ignore_args, int from_tty, 
+                              struct cmd_list_element *c);
 
 static CORE_ADDR cris_scan_prologue (CORE_ADDR pc, 
 				     struct frame_info *next_frame,
@@ -564,8 +362,9 @@
 				 struct frame_info *next_frame);
 
 /* When arguments must be pushed onto the stack, they go on in reverse
-   order.  The below implements a FILO (stack) to do this.  
-   Copied from d10v-tdep.c.  */
+   order.  The below implements a FILO (stack) to do this. */
+
+/* Borrowed from d10v-tdep.c.  */
 
 struct stack_item
 {
@@ -600,7 +399,7 @@
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
    in the stack frame.  sp is even more special: the address we return
-   for it IS the sp for the next frame.  */
+   for it IS the sp for the next frame. */
 
 struct cris_unwind_cache *
 cris_frame_unwind_cache (struct frame_info *next_frame,
@@ -732,7 +531,7 @@
 
   struct stack_item *si = NULL;
 
-  /* Push the return address.  */
+  /* Push the return address. */
   regcache_cooked_write_unsigned (regcache, SRP_REGNUM, bp_addr);
 
   /* Are we returning a value using a structure return or a normal value
@@ -968,7 +767,7 @@
   limit = next_frame ? frame_pc_unwind (next_frame) : pc + 64;
 
   /* Find the prologue instructions.  */
-  while (pc > 0 && pc < limit)
+  while (pc < limit)
     {
       insn = read_memory_unsigned_integer (pc, 2);
       pc += 2;
@@ -1370,8 +1169,13 @@
     /* Writing has no effect.  */
     return 1;
 
-  /* IBR, BAR, BRP and IRP are read-only in user mode.  Let the debug
-     agent decide whether they are writable.  */
+  else if (cris_mode () == CRIS_MODE_USER)
+    {
+      if (regno == IBR_REGNUM || regno == BAR_REGNUM || regno == BRP_REGNUM 
+          || regno == IRP_REGNUM)
+        /* Read-only in user mode.  */
+        return 1;
+    }
   
   return 0;
 }
@@ -1398,7 +1202,7 @@
     }
   else
     {
-      /* Invalid register.  */
+      /* Invalid register. */
       return -1;
     }
 }
@@ -1409,21 +1213,33 @@
 static struct type *
 cris_register_type (struct gdbarch *gdbarch, int regno)
 {
-  if (regno == PC_REGNUM)
-    return builtin_type_void_func_ptr;
-  else if (regno == SP_REGNUM || regno == CRIS_FP_REGNUM)
-    return builtin_type_void_data_ptr;
-  else if ((regno >= 0 && regno < SP_REGNUM)
-	   || (regno >= MOF_REGNUM && regno <= USP_REGNUM))
-    /* Note: R8 taken care of previous clause.  */
-    return builtin_type_uint32;
-  else if (regno >= P4_REGNUM && regno <= CCR_REGNUM)
-      return builtin_type_uint16;
-  else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
-      return builtin_type_uint8;
+  if (regno == SP_REGNUM || regno == PC_REGNUM
+      || (regno > P8_REGNUM && regno < USP_REGNUM))
+    {
+      /* SP, PC, IBR, IRP, SRP, BAR, DCCR, BRP */
+      return lookup_pointer_type (builtin_type_void);
+    }
+  else if (regno == P8_REGNUM || regno == USP_REGNUM
+           || (regno >= 0 && regno < SP_REGNUM))
+    {
+      /* R0 - R13, P8, P15 */
+      return builtin_type_unsigned_long;
+    }
+  else if (regno > P3_REGNUM && regno < P8_REGNUM)
+    {
+      /* P4, CCR, DCR0, DCR1 */
+      return builtin_type_unsigned_short;
+    }
+  else if (regno > PC_REGNUM && regno < P4_REGNUM)
+    {
+      /* P0, P1, P2, P3 */
+      return builtin_type_unsigned_char;
+    }
   else
-      /* Invalid (unimplemented) register.  */
-      return builtin_type_int0;
+    {
+      /* Invalid register.  */
+      return builtin_type_void;
+    }
 }
 
 /* Stores a function return value of type type, where valbuf is the address 
@@ -1501,49 +1317,10 @@
     }
 }
 
-/* Convert DWARF register number REG to the appropriate register
-   number used by GDB.  */
-
 static int
-cris_dwarf2_reg_to_regnum (int reg)
+cris_register_bytes_ok (long bytes)
 {
-  /* We need to re-map a couple of registers (SRP is 16 in Dwarf-2 register
-     numbering, MOF is 18).
-     Adapted from gcc/config/cris/cris.h.  */
-  static int cris_dwarf_regmap[] = {
-    0,  1,  2,  3,
-    4,  5,  6,  7,
-    8,  9,  10, 11,
-    12, 13, 14, 15,
-    27, -1, -1, -1,
-    -1, -1, -1, 23,
-    -1, -1, -1, 27,
-    -1, -1, -1, -1
-  };
-  int regnum = -1;
-
-  if (reg >= 0 && reg < ARRAY_SIZE (cris_dwarf_regmap))
-    regnum = cris_dwarf_regmap[reg];
-
-  if (regnum == -1)
-    warning ("Unmapped DWARF Register #%d encountered\n", reg);
-
-  return regnum;
-}
-
-/* DWARF-2 frame support.  */
-
-static void
-cris_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
-                            struct dwarf2_frame_state_reg *reg)
-{
-  /* The return address column.  */
-  if (regnum == PC_REGNUM)
-    reg->how = DWARF2_FRAME_REG_RA;
-
-  /* The call frame address.  */
-  else if (regnum == SP_REGNUM)
-    reg->how = DWARF2_FRAME_REG_CFA;
+  return (bytes == deprecated_register_bytes ());
 }
 
 /* Extract from an array regbuf containing the raw register state a function
@@ -1819,7 +1596,6 @@
       if (status == -1)
         {
           /* Could not find a target.  FIXME: Should do something.  */
-          warning ("cris_software_single_step: unable to find step target");
         }
       else
         {
@@ -3536,7 +3312,7 @@
      disassembler, even when there is no BFD.  Does something like
      "gdb; target remote; disassmeble *0x123" work?  */
   gdb_assert (exec_bfd != NULL);
-  print_insn = cris_get_disassembler (exec_bfd);
+  print_insn =  cris_get_disassembler (exec_bfd);
   gdb_assert (print_insn != NULL);
   return print_insn (addr, info);
 }
@@ -3647,38 +3423,230 @@
   return lmp;
 }
 
+static void
+cris_fpless_backtrace (char *noargs, int from_tty)
+{
+  /* Points at the instruction after the jsr (except when in innermost frame
+     where it points at the original pc).  */
+  CORE_ADDR pc = 0;
+
+  /* Temporary variable, used for parsing from the start of the function that
+     the pc is in, up to the pc.  */
+  CORE_ADDR tmp_pc = 0;
+  CORE_ADDR sp = 0;
+
+  /* Information about current frame.  */
+  struct symtab_and_line sal;
+  char* func_name;
+
+  /* Present instruction.  */
+  unsigned short insn;
+  
+  /* Next instruction, lookahead.  */
+  unsigned short insn_next; 
+
+  /* This is to store the offset between sp at start of function and until we
+     reach push srp (if any).  */
+  int sp_add_later = 0;
+  int push_srp_found = 0;
+
+  int val = 0;
+
+  /* Frame counter.  */
+  int frame = 0;
+
+  /* For the innermost frame, we want to look at srp in case it's a leaf
+     function (since there's no push srp in that case).  */
+  int innermost_frame = 1;
+  
+  deprecated_read_register_gen (PC_REGNUM, (char *) &pc);
+  deprecated_read_register_gen (SP_REGNUM, (char *) &sp);
+  
+  /* We make an explicit return when we can't find an outer frame.  */
+  while (1)
+    {
+      /* Get file name and line number.  */
+      sal = find_pc_line (pc, 0);
+
+      /* Get function name.  */
+      find_pc_partial_function (pc, &func_name, (CORE_ADDR *) NULL,
+                                (CORE_ADDR *) NULL);
+
+      /* Print information about current frame.  */
+      printf_unfiltered ("#%i  0x%08lx in %s", frame++, pc, func_name);
+      if (sal.symtab)
+        {    
+          printf_unfiltered (" at %s:%i", sal.symtab->filename, sal.line);
+        }
+      printf_unfiltered ("\n");
+      
+      /* Get the start address of this function.  */
+      tmp_pc = get_pc_function_start (pc);
+  
+      /* Mini parser, only meant to find push sp and sub ...,sp from the start
+         of the function, up to the pc.  */
+      while (tmp_pc < pc)
+        {
+          insn = read_memory_unsigned_integer (tmp_pc, sizeof (short));
+          tmp_pc += sizeof (short);
+          if (insn == 0xE1FC)
+            {
+              /* push <reg> 32 bit instruction */
+              insn_next = read_memory_unsigned_integer (tmp_pc, 
+                                                        sizeof (short));
+              tmp_pc += sizeof (short);
+
+              /* Recognize srp.  */
+              if (insn_next == 0xBE7E)
+                {
+                  /* For subsequent (not this one though) push or sub which
+                     affects sp, adjust sp immediately.  */
+                  push_srp_found = 1;
+
+                  /* Note: this will break if we ever encounter a 
+                     push vr (1 byte) or push ccr (2 bytes).  */
+                  sp_add_later += 4;
+                }
+              else
+                {
+                  /* Some other register was pushed.  */
+                  if (push_srp_found)
+                    {    
+                      sp += 4;
+                    }
+                  else
+                    {
+                      sp_add_later += 4;
+                    }
+                }
+            }
+          else if (cris_get_operand2 (insn) == SP_REGNUM 
+                   && cris_get_mode (insn) == 0x0000
+                   && cris_get_opcode (insn) == 0x000A)
+            {
+              /* subq <val>,sp */
+              val = cris_get_quick_value (insn);
+
+              if (push_srp_found)
+                {
+                  sp += val;
+                }
+              else
+                {
+                  sp_add_later += val;
+                }
+              
+            }
+          else if (cris_get_operand2 (insn) == SP_REGNUM
+                   /* Autoincrement addressing mode.  */
+                   && cris_get_mode (insn) == 0x0003
+                   /* Opcode.  */
+                   && ((insn) & 0x03E0) >> 5 == 0x0004)
+            {
+              /* subu <val>,sp */
+              val = get_data_from_address (&insn, tmp_pc);
+
+              if (push_srp_found)
+                {
+                  sp += val;
+                }
+              else
+                {
+                  sp_add_later += val;
+                }
+            }
+          else if (cris_get_operand2 (insn) == SP_REGNUM
+                   && ((insn & 0x0F00) >> 8) == 0x0001
+                   && (cris_get_signed_offset (insn) < 0))
+            {
+              /* Immediate byte offset addressing prefix word with sp as base 
+                 register.  Used for CRIS v8 i.e. ETRAX 100 and newer if <val> 
+                 is between 64 and 128. 
+                 movem r<regsave>,[sp=sp-<val>] */
+              val = -cris_get_signed_offset (insn);
+              insn_next = read_memory_unsigned_integer (tmp_pc, 
+                                                        sizeof (short));
+              tmp_pc += sizeof (short);
+              
+              if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
+                  && cris_get_opcode (insn_next) == 0x000F
+                  && cris_get_size (insn_next) == 0x0003
+                  && cris_get_operand1 (insn_next) == SP_REGNUM)
+                {             
+                  if (push_srp_found)
+                    {
+                      sp += val;
+                    }
+                  else
+                    {
+                      sp_add_later += val;
+                    }
+                }
+            }
+        }
+      
+      if (push_srp_found)
+        {
+          /* Reset flag.  */
+          push_srp_found = 0;
+
+          /* sp should now point at where srp is stored on the stack.  Update
+             the pc to the srp.  */
+          pc = read_memory_unsigned_integer (sp, 4);
+        }
+      else if (innermost_frame)
+        {
+          /* We couldn't find a push srp in the prologue, so this must be
+             a leaf function, and thus we use the srp register directly.
+             This should happen at most once, for the innermost function.  */
+          deprecated_read_register_gen (SRP_REGNUM, (char *) &pc);
+        }
+      else
+        {
+          /* Couldn't find an outer frame.  */
+          return;
+        }
+
+      /* Reset flag.  (In case the innermost frame wasn't a leaf, we don't
+         want to look at the srp register later either).  */
+      innermost_frame = 0;
+
+      /* Now, add the offset for everything up to, and including push srp,
+         that was held back during the prologue parsing.  */ 
+      sp += sp_add_later;
+      sp_add_later = 0;
+    }
+}
+
 extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */
 
 void
 _initialize_cris_tdep (void)
 {
-  static struct cmd_list_element *cris_set_cmdlist;
-  static struct cmd_list_element *cris_show_cmdlist;
-
   struct cmd_list_element *c;
 
   gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
   
   /* CRIS-specific user-commands.  */
-  add_setshow_uinteger_cmd ("cris-version", class_support, 
-			    &usr_cmd_cris_version, 
-			    "Set the current CRIS version.",
-			    "Show the current CRIS version.",
-			    "Set if autodetection fails.",
-			    "Current CRIS version is %s.",
-			    set_cris_version, NULL,
-			    &setlist, &showlist);
+  c = add_set_cmd ("cris-version", class_support, var_integer, 
+                   (char *) &usr_cmd_cris_version, 
+                   "Set the current CRIS version.", &setlist);
+  set_cmd_sfunc (c, cris_version_update);
+  deprecated_add_show_from_set (c, &showlist);
   
-  add_setshow_boolean_cmd ("cris-dwarf2-cfi", class_support,
-			   &usr_cmd_cris_dwarf2_cfi,
-			   "Set the usage of Dwarf-2 CFI for CRIS.",
-			   "Show the usage of Dwarf-2 CFI for CRIS.",
-			   "Set to \"off\" if using gcc-cris < R59.",
-			   "Usage of Dwarf-2 CFI for CRIS is %d.",
-			   set_cris_dwarf2_cfi, NULL,
-			   &setlist, &showlist);
+  c = add_set_enum_cmd ("cris-mode", class_support, cris_mode_enums, 
+                        &usr_cmd_cris_mode, 
+                        "Set the current CRIS mode.", &setlist);
+  set_cmd_sfunc (c, cris_mode_update);
+  deprecated_add_show_from_set (c, &showlist);
 
+  c = add_cmd ("cris-fpless-backtrace", class_support, cris_fpless_backtrace, 
+               "Display call chain using the subroutine return pointer.\n"
+               "Note that this displays the address after the jump to the "
+               "subroutine.", &cmdlist);
+  
   deprecated_add_core_fns (&cris_elf_core_fns);
+  
 }
 
 /* Prints out all target specific values.  */
@@ -3691,37 +3659,65 @@
     {
       fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
                           tdep->cris_version);
-      fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_dwarf2_cfi = %i\n",
-                          tdep->cris_dwarf2_cfi);
+      fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_mode = %s\n",
+                          tdep->cris_mode);
     }
 }
 
 static void
-set_cris_version (char *ignore_args, int from_tty, 
-		  struct cmd_list_element *c)
+cris_version_update (char *ignore_args, int from_tty, 
+                     struct cmd_list_element *c)
 {
   struct gdbarch_info info;
 
-  usr_cmd_cris_version_valid = 1;
+  /* NOTE: cagney/2002-03-17: The deprecated_add_show_from_set()
+     function clones the set command passed as a parameter.  The clone
+     operation will include (BUG?) any ``set'' command callback, if
+     present.  Commands like ``info set'' call all the ``show''
+     command callbacks.  Unfortunately, for ``show'' commands cloned
+     from ``set'', this includes callbacks belonging to ``set''
+     commands.  Making this worse, this only occures if
+     deprecated_add_show_from_set() is called after add_cmd_sfunc()
+     (BUG?).  */
+
+  /* From here on, trust the user's CRIS version setting.  */
+  if (cmd_type (c) == set_cmd)
+    {
+      usr_cmd_cris_version_valid = 1;
   
-  /* Update the current architecture, if needed.  */
-  gdbarch_info_init (&info);
-  if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, 
-		    "cris_gdbarch_update: failed to update architecture.");
+      /* Update the current architecture, if needed.  */
+      gdbarch_info_init (&info);
+      if (!gdbarch_update_p (info))
+        internal_error (__FILE__, __LINE__, "cris_gdbarch_update: failed to update architecture.");
+    }  
 }
 
 static void
-set_cris_dwarf2_cfi (char *ignore_args, int from_tty, 
-		     struct cmd_list_element *c)
+cris_mode_update (char *ignore_args, int from_tty, 
+                 struct cmd_list_element *c)
 {
   struct gdbarch_info info;
+  
+  /* NOTE: cagney/2002-03-17: The deprecated_add_show_from_set()
+     function clones the set command passed as a parameter.  The clone
+     operation will include (BUG?) any ``set'' command callback, if
+     present.  Commands like ``info set'' call all the ``show''
+     command callbacks.  Unfortunately, for ``show'' commands cloned
+     from ``set'', this includes callbacks belonging to ``set''
+     commands.  Making this worse, this only occures if
+     deprecated_add_show_from_set() is called after add_cmd_sfunc()
+     (BUG?).  */
 
-  /* Update the current architecture, if needed.  */
-  gdbarch_info_init (&info);
-  if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, 
-		    "cris_gdbarch_update: failed to update architecture.");
+  /* From here on, trust the user's CRIS mode setting.  */
+  if (cmd_type (c) == set_cmd)
+    {
+      usr_cmd_cris_mode_valid = 1;
+  
+      /* Update the current architecture, if needed.  */
+      gdbarch_info_init (&info);
+      if (!gdbarch_update_p (info))
+        internal_error (__FILE__, __LINE__, "cris_gdbarch_update: failed to update architecture.");
+    }
 }
 
 static struct gdbarch *
@@ -3730,6 +3726,8 @@
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
   int cris_version;
+  const char *cris_mode;
+  int register_bytes;
 
   if (usr_cmd_cris_version_valid)
     {
@@ -3742,8 +3740,26 @@
       cris_version = 10;
     }
 
+  if (usr_cmd_cris_mode_valid)
+    {
+      /* Trust the user's CRIS mode setting.  */ 
+      cris_mode = usr_cmd_cris_mode;
+    }
+  else if (cris_version == 10)
+    {
+      /* Assume CRIS version 10 is in user mode.  */
+      cris_mode = CRIS_MODE_USER;
+    }
+  else
+    {
+      /* Strictly speaking, older CRIS version don't have a supervisor mode,
+         but we regard its only mode as supervisor mode.  */
+      cris_mode = CRIS_MODE_SUPERVISOR;
+    }
+
   /* Make the current settings visible to the user.  */
   usr_cmd_cris_version = cris_version;
+  usr_cmd_cris_mode = cris_mode;
   
   /* Find a candidate among the list of pre-declared architectures.  Both
      CRIS version and ABI must match.  */
@@ -3751,10 +3767,8 @@
        arches != NULL;
        arches = gdbarch_list_lookup_by_info (arches->next, &info))
     {
-      if ((gdbarch_tdep (arches->gdbarch)->cris_version 
-	   == usr_cmd_cris_version)
-	  && (gdbarch_tdep (arches->gdbarch)->cris_dwarf2_cfi 
-	      == usr_cmd_cris_dwarf2_cfi))
+      if ((gdbarch_tdep (arches->gdbarch)->cris_version == cris_version)
+          && (gdbarch_tdep (arches->gdbarch)->cris_mode == cris_mode))
         return arches->gdbarch;
     }
 
@@ -3762,8 +3776,8 @@
   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  tdep->cris_version = usr_cmd_cris_version;
-  tdep->cris_dwarf2_cfi = usr_cmd_cris_dwarf2_cfi;
+  tdep->cris_version = cris_version;
+  tdep->cris_mode = cris_mode;
 
   /* INIT shall ensure that the INFO.BYTE_ORDER is non-zero.  */
   switch (info.byte_order)
@@ -3790,11 +3804,16 @@
   set_gdbarch_sp_regnum (gdbarch, 14);
   set_gdbarch_pc_regnum (gdbarch, 15);
   set_gdbarch_register_name (gdbarch, cris_register_name);
-
+  
+  /* Length of ordinary registers used in push_word and a few other
+     places.  register_size() is the real way to know how big a
+     register is.  */
+  set_gdbarch_deprecated_register_size (gdbarch, 4);
   set_gdbarch_double_bit (gdbarch, 64);
   /* The default definition of a long double is 2 * TARGET_DOUBLE_BIT,
      which means we have to set this explicitly.  */
   set_gdbarch_long_double_bit (gdbarch, 64);  
+  set_gdbarch_register_bytes_ok (gdbarch, cris_register_bytes_ok);
   set_gdbarch_cannot_store_register (gdbarch, cris_cannot_store_register);
   set_gdbarch_cannot_fetch_register (gdbarch, cris_cannot_fetch_register);
 
@@ -3808,23 +3827,33 @@
     case 1:
     case 2:
     case 3:
+      /* Support for these may be added later.  */
+      internal_error (__FILE__, __LINE__, "cris_gdbarch_init: unsupported CRIS version");
+      break;
+      
     case 8:
     case 9:
-      /* Old versions; not supported.  */
-      internal_error (__FILE__, __LINE__, 
-		      "cris_gdbarch_init: unsupported CRIS version");
+      /* CRIS v8 and v9, a.k.a. ETRAX 100.  General registers R0 - R15 
+         (32 bits), special registers P0 - P1 (8 bits), P4 - P5 (16 bits), 
+         and P8 - P14 (32 bits).  */
+      register_bytes = (16 * 4) + (2 * 1) + (2 * 2) + (7 * 4);
       break;
 
     case 10:
     case 11: 
       /* CRIS v10 and v11, a.k.a. ETRAX 100LX.  In addition to ETRAX 100, 
          P7 (32 bits), and P15 (32 bits) have been implemented.  */
+      register_bytes = (16 * 4) + (2 * 1) + (2 * 2) + (9 * 4);
       break;
 
     default:
       internal_error (__FILE__, __LINE__, "cris_gdbarch_init: unknown CRIS version");
     }
 
+  /* Returns the register offset for the first byte of register regno's space 
+     in the saved register state.  */
+  set_gdbarch_deprecated_register_byte (gdbarch, cris_register_offset);
+  
   set_gdbarch_register_type (gdbarch, cris_register_type);
   
   /* Dummy frame functions.  */
@@ -3844,16 +3873,9 @@
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
   set_gdbarch_unwind_dummy_id (gdbarch, cris_unwind_dummy_id);
 
-  if (tdep->cris_dwarf2_cfi == 1)
-    {
-      /* Hook in the Dwarf-2 frame sniffer.  */
-      set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum);
-      dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg);
-      frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-    }
-
-  frame_unwind_append_sniffer (gdbarch, cris_sigtramp_frame_sniffer);
-
+  /* FIXME: Hook in the DWARF CFI frame unwinder.
+     frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+  */
   frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer);
   frame_base_set_default (gdbarch, &cris_frame_base);
 
diff --git a/gdb/defs.h b/gdb/defs.h
index fd96665..63477de 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -197,7 +197,6 @@
     language_asm,		/* Assembly language */
     language_scm,    		/* Scheme / Guile */
     language_pascal,		/* Pascal */
-    language_ada,		/* Ada */
     language_minimal,		/* All other languages, minimal support only */
     nr_languages
   };
@@ -804,16 +803,11 @@
 #include "tm.h"
 #endif
 
-/* Assume that fopen accepts the letter "b" in the mode string.
-   Support for is demanded by ISO C90, and should be supported on all
-   platforms that claim to have a standards conforming C library.  On
-   true POSIX systems it will be ignored and have no effect.  There
-   may still be systems without a standards conforming C library where
-   an ISO C90 compiler (GCC) is available.  Known examples are SunOS
-   4.x and 4.3BSD.  This assumption means these systems are no longer
-   supported.  */
+/* If the xm.h file did not define the mode string used to open the
+   files, assume that binary files are opened the same way as text
+   files */
 #ifndef FOPEN_RB
-# include "fopen-bin.h"
+#include "fopen-same.h"
 #endif
 
 /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
@@ -858,6 +852,10 @@
 
 extern char *savestring (const char *, size_t);
 
+extern char *msavestring (void *, const char *, size_t);
+
+extern char *mstrsave (void *, const char *);
+
 /* xmalloc(), xrealloc() and xcalloc() have already been declared in
    "libiberty.h". */
 extern void xfree (void *);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index c46594b..67bcf52 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,39 +1,3 @@
-2004-10-12  Andrew Cagney  <cagney@gnu.org>
-
-	* gdbint.texinfo (Versions and Branches): New chapter.
-	(Releasing GDB): Delete "Versions and Branches" section.
-	(Top): Add "Versions and Branches".
-
-2004-10-08  Eli Zaretskii  <eliz@gnu.org>
-
-	* gdb.texinfo (Editing, History): Add cross-references to the
-	included Readline and History user documentation.  Remove
-	references to the symbol have-readline-appendices which is unused
-	and undefined.
-	(History): Fix indexing.
-
-2004-10-08  Jeff Johnston  <jjohnstn@redhat.com>
-
-	* gdbint.texinfo (target_stopped_data_address): Update to
-	new prototype.
-	(i386_stopped_data_address): Update prototype and description.
-	(i386_stopped_by_watchpoint): New function and description.
-
-2004-10-03  Paul N. Hilfinger  <hilfinger@gnat.com>
-
-	* gdb.texinfo (Filenames): Add Ada suffixes.
-	(Ada) New section.
-
-2004-09-27  Andrew Cagney  <cagney@gnu.org>
-	    Robert Picco  <Robert.Picco@hp.com>
-
-	* gdb.texinfo (Packets): Document the "p" packet.
-
-2004-09-21  Jason Molenda  (jmolenda@apple.com)
-
-	* gdb.texinfo (Paths and Names of the Source Files): Document the
-	meaning of values in the 'desc' field of a SO stab.
-
 2004-09-20  Daniel Jacobowitz  <dan@debian.org>
 
 	* gdb.texinfo (Maintenance Commands): Document "maint set dwarf2
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6af8d37..d2174ec 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7717,11 +7717,6 @@
 @value{GDBN} infers that its language is the one indicated.
 
 @table @file
-@item .ada
-@itemx .ads
-@itemx .adb
-@itemx .a
-Ada source file.
 
 @item .c
 C source file
@@ -8010,7 +8005,7 @@
 @node Support
 @section Supported languages
 
-@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, Modula-2, and Ada.
+@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, and Modula-2.
 @c This is false ...
 Some @value{GDBN} features may be used in expressions regardless of the
 language you use: the @value{GDBN} @code{@@} and @code{::} operators,
@@ -8030,7 +8025,6 @@
 * C::                           C and C@t{++}
 * Objective-C::                 Objective-C
 * Modula-2::                    Modula-2
-* Ada::                         Ada
 @end menu
 
 @node C
@@ -8646,7 +8640,7 @@
 with certain Objective-C libraries that have a particular hook
 function, @code{_NSPrintForDebugger}, defined.
 
-@node Modula-2, Ada, Objective-C, Support
+@node Modula-2,  , Objective-C, Support
 @subsection Modula-2
 
 @cindex Modula-2, @value{GDBN} support
@@ -9089,341 +9083,6 @@
 In @value{GDBN} scripts, the Modula-2 inequality operator @code{#} is
 interpreted as the beginning of a comment.  Use @code{<>} instead.
 
-@node Ada
-@subsection Ada
-@cindex Ada
-
-The extensions made to @value{GDBN} for Ada only support
-output from the @sc{gnu} Ada (GNAT) compiler.
-Other Ada compilers are not currently supported, and
-attempting to debug executables produced by them is most likely
-to be difficult.
-
-
-@cindex expressions in Ada
-@menu
-* Ada Mode Intro::              General remarks on the Ada syntax 
-                                   and semantics supported by Ada mode 
-                                   in @value{GDBN}.
-* Omissions from Ada::          Restrictions on the Ada expression syntax.
-* Additions to Ada::            Extensions of the Ada expression syntax.
-* Stopping Before Main Program:: Debugging the program during elaboration.
-* Ada Glitches::                Known peculiarities of Ada mode.
-@end menu
-
-@node Ada Mode Intro
-@subsubsection Introduction
-@cindex Ada mode, general
-
-The Ada mode of @value{GDBN} supports a fairly large subset of Ada expression 
-syntax, with some extensions.
-The philosophy behind the design of this subset is 
-
-@itemize @bullet
-@item
-That @value{GDBN} should provide basic literals and access to operations for 
-arithmetic, dereferencing, field selection, indexing, and subprogram calls, 
-leaving more sophisticated computations to subprograms written into the
-program (which therefore may be called from @value{GDBN}).
-
-@item 
-That type safety and strict adherence to Ada language restrictions
-are not particularly important to the @value{GDBN} user.
-
-@item 
-That brevity is important to the @value{GDBN} user.
-@end itemize
-
-Thus, for brevity, the debugger acts as if there were 
-implicit @code{with} and @code{use} clauses in effect for all user-written 
-packages, making it unnecessary to fully qualify most names with 
-their packages, regardless of context.  Where this causes ambiguity, 
-@value{GDBN} asks the user's intent.
-
-The debugger will start in Ada mode if it detects an Ada main program. 
-As for other languages, it will enter Ada mode when stopped in a program that
-was translated from an Ada source file.
-
-While in Ada mode, you may use `@t{--}' for comments.  This is useful 
-mostly for documenting command files.  The standard @value{GDBN} comment 
-(@samp{#}) still works at the beginning of a line in Ada mode, but not in the 
-middle (to allow based literals).
-
-The debugger supports limited overloading.  Given a subprogram call in which
-the function symbol has multiple definitions, it will use the number of 
-actual parameters and some information about their types to attempt to narrow
-the set of definitions.  It also makes very limited use of context, preferring
-procedures to functions in the context of the @code{call} command, and
-functions to procedures elsewhere. 
-
-@node Omissions from Ada
-@subsubsection Omissions from Ada
-@cindex Ada, omissions from
-
-Here are the notable omissions from the subset:
-
-@itemize @bullet
-@item
-Only a subset of the attributes are supported:
-
-@itemize @minus
-@item
-@t{'First}, @t{'Last}, and @t{'Length}
- on array objects (not on types and subtypes).
-
-@item
-@t{'Min} and @t{'Max}.  
-
-@item 
-@t{'Pos} and @t{'Val}. 
-
-@item
-@t{'Tag}.
-
-@item
-@t{'Range} on array objects (not subtypes), but only as the right
-operand of the membership (@code{in}) operator.
-
-@item 
-@t{'Access}, @t{'Unchecked_Access}, and 
-@t{'Unrestricted_Access} (a GNAT extension).
-
-@item
-@t{'Address}.
-@end itemize
-
-@item
-The names in
-@code{Characters.Latin_1} are not available and
-concatenation is not implemented.  Thus, escape characters in strings are 
-not currently available.
-
-@item
-Equality tests (@samp{=} and @samp{/=}) on arrays test for bitwise
-equality of representations.  They will generally work correctly
-for strings and arrays whose elements have integer or enumeration types.
-They may not work correctly for arrays whose element
-types have user-defined equality, for arrays of real values 
-(in particular, IEEE-conformant floating point, because of negative
-zeroes and NaNs), and for arrays whose elements contain unused bits with
-indeterminate values.  
-
-@item
-The other component-by-component array operations (@code{and}, @code{or}, 
-@code{xor}, @code{not}, and relational tests other than equality)
-are not implemented. 
-
-@item 
-There are no record or array aggregates.
-
-@item
-Calls to dispatching subprograms are not implemented.
-
-@item
-The overloading algorithm is much more limited (i.e., less selective)
-than that of real Ada.  It makes only limited use of the context in which a subexpression
-appears to resolve its meaning, and it is much looser in its rules for allowing
-type matches.  As a result, some function calls will be ambiguous, and the user
-will be asked to choose the proper resolution.
-
-@item
-The @code{new} operator is not implemented.
-
-@item
-Entry calls are not implemented.
-
-@item 
-Aside from printing, arithmetic operations on the native VAX floating-point 
-formats are not supported.
-
-@item
-It is not possible to slice a packed array.
-@end itemize
-
-@node Additions to Ada
-@subsubsection Additions to Ada
-@cindex Ada, deviations from 
-
-As it does for other languages, @value{GDBN} makes certain generic
-extensions to Ada (@pxref{Expressions}):
-
-@itemize @bullet
-@item
-If the expression @var{E} is a variable residing in memory 
-(typically a local variable or array element) and @var{N} is 
-a positive integer, then @code{@var{E}@@@var{N}} displays the values of
-@var{E} and the @var{N}-1 adjacent variables following it in memory as an array.  
-In Ada, this operator is generally not necessary, since its prime use
-is in displaying parts of an array, and slicing will usually do this in Ada.
-However, there are occasional uses when debugging programs
-in which certain debugging information has been optimized away.
-
-@item
-@code{@var{B}::@var{var}} means ``the variable named @var{var} that appears
-in function or file @var{B}.''  When @var{B} is a file name, you must typically
-surround it in single quotes.
-
-@item 
-The expression @code{@{@var{type}@} @var{addr}} means ``the variable of type
-@var{type} that appears at address @var{addr}.''
-
-@item
-A name starting with @samp{$} is a convenience variable 
-(@pxref{Convenience Vars}) or a machine register (@pxref{Registers}).
-@end itemize
-
-In addition, @value{GDBN} provides a few other shortcuts and outright additions specific 
-to Ada:
-
-@itemize @bullet
-@item 
-The assignment statement is allowed as an expression, returning
-its right-hand operand as its value.  Thus, you may enter
-
-@smallexample
-set x := y + 3
-print A(tmp := y + 1)
-@end smallexample
-
-@item 
-The semicolon is allowed as an ``operator,''  returning as its value 
-the value of its right-hand operand.
-This allows, for example,
-complex conditional breaks:
-
-@smallexample
-break f
-condition 1 (report(i); k += 1; A(k) > 100)
-@end smallexample
-
-@item 
-Rather than use catenation and symbolic character names to introduce special 
-characters into strings, one may instead use a special bracket notation, 
-which is also used to print strings.  A sequence of characters of the form 
-@samp{["@var{XX}"]} within a string or character literal denotes the 
-(single) character whose numeric encoding is @var{XX} in hexadecimal.  The
-sequence of characters @samp{["""]} also denotes a single quotation mark 
-in strings.   For example,
-@smallexample
-   "One line.["0a"]Next line.["0a"]"
-@end smallexample
-@noindent
-contains an ASCII newline character (@code{Ada.Characters.Latin_1.LF}) after each
-period.
-
-@item
-The subtype used as a prefix for the attributes @t{'Pos}, @t{'Min}, and
-@t{'Max} is optional (and is ignored in any case).  For example, it is valid
-to write
-
-@smallexample
-print 'max(x, y)
-@end smallexample
-
-@item
-When printing arrays, @value{GDBN} uses positional notation when the 
-array has a lower bound of 1, and uses a modified named notation otherwise.
-For example, a one-dimensional array of three integers with a lower bound of 3 might print as
-
-@smallexample
-(3 => 10, 17, 1)
-@end smallexample
-
-@noindent
-That is, in contrast to valid Ada, only the first component has a @code{=>} 
-clause.
-
-@item
-You may abbreviate attributes in expressions with any unique,
-multi-character subsequence of 
-their names (an exact match gets preference).
-For example, you may use @t{a'len}, @t{a'gth}, or @t{a'lh}
-in place of  @t{a'length}.
-
-@item
-@cindex quoting Ada internal identifiers
-Since Ada is case-insensitive, the debugger normally maps identifiers you type 
-to lower case.  The GNAT compiler uses upper-case characters for 
-some of its internal identifiers, which are normally of no interest to users.
-For the rare occasions when you actually have to look at them,
-enclose them in angle brackets to avoid the lower-case mapping. 
-For example,
-@smallexample
-@value{GDBP} print <JMPBUF_SAVE>[0]
-@end smallexample
-
-@item
-Printing an object of class-wide type or dereferencing an 
-access-to-class-wide value will display all the components of the object's
-specific type (as indicated by its run-time tag).  Likewise, component
-selection on such a value will operate on the specific type of the
-object.
-
-@end itemize
-
-@node Stopping Before Main Program
-@subsubsection Stopping at the Very Beginning
-
-@cindex breakpointing Ada elaboration code
-It is sometimes necessary to debug the program during elaboration, and
-before reaching the main procedure.
-As defined in the Ada Reference
-Manual, the elaboration code is invoked from a procedure called
-@code{adainit}.  To run your program up to the beginning of
-elaboration, simply use the following two commands:
-@code{tbreak adainit} and @code{run}.
-
-@node Ada Glitches
-@subsubsection Known Peculiarities of Ada Mode
-@cindex Ada, problems
-
-Besides the omissions listed previously (@pxref{Omissions from Ada}),
-we know of several problems with and limitations of Ada mode in
-@value{GDBN},
-some of which will be fixed with planned future releases of the debugger 
-and the GNU Ada compiler.
-
-@itemize @bullet
-@item
-Currently, the debugger 
-has insufficient information to determine whether certain pointers represent
-pointers to objects or the objects themselves.
-Thus, the user may have to tack an extra @code{.all} after an expression
-to get it printed properly.
-
-@item 
-Static constants that the compiler chooses not to materialize as objects in 
-storage are invisible to the debugger.
-
-@item
-Named parameter associations in function argument lists are ignored (the
-argument lists are treated as positional).
-
-@item
-Many useful library packages are currently invisible to the debugger.
-
-@item
-Fixed-point arithmetic, conversions, input, and output is carried out using 
-floating-point arithmetic, and may give results that only approximate those on 
-the host machine.
-
-@item
-The type of the @t{'Address} attribute may not be @code{System.Address}.
-
-@item
-The GNAT compiler never generates the prefix @code{Standard} for any of 
-the standard symbols defined by the Ada language.  @value{GDBN} knows about 
-this: it will strip the prefix from names when you use it, and will never
-look for a name you have so qualified among local symbols, nor match against
-symbols in other packages or subprograms.  If you have 
-defined entities anywhere in your program other than parameters and 
-local variables whose simple names match names in @code{Standard}, 
-GNAT's lack of qualification here can cause confusion.  When this happens,
-you can usually resolve the confusion 
-by qualifying the problematic names with package
-@code{Standard} explicitly.  
-@end itemize
-
 @node Unsupported languages
 @section Unsupported languages
 
@@ -13383,7 +13042,7 @@
 @cindex readline
 @cindex command line editing
 
-@value{GDBN} reads its input commands via the @dfn{Readline} interface.  This
+@value{GDBN} reads its input commands via the @dfn{readline} interface.  This
 @sc{gnu} library provides consistent behavior for programs which provide a
 command line interface to the user.  Advantages are @sc{gnu} Emacs-style
 or @dfn{vi}-style inline editing of commands, @code{csh}-like history
@@ -13408,26 +13067,14 @@
 Show whether command line editing is enabled.
 @end table
 
-@xref{Command Line Editing}, for more details about the Readline
-interface.  Users unfamiliar with @sc{gnu} Emacs or @code{vi} are
-encouraged to read that chapter.
-
 @node History
 @section Command history
-@cindex command history
 
 @value{GDBN} can keep track of the commands you type during your
 debugging sessions, so that you can be certain of precisely what
 happened.  Use these commands to manage the @value{GDBN} command
 history facility.
 
-@value{GDBN} uses the @sc{gnu} History library, a part of the Readline
-package, to provide the history facility.  @xref{Using History
-Interactively}, for the detailed description of the History library.
-
-Here is the description of @value{GDBN} commands related to command
-history.
-
 @table @code
 @cindex history substitution
 @cindex history file
@@ -13460,10 +13107,12 @@
 @code{HISTSIZE}, or to 256 if this variable is not set.
 @end table
 
+@cindex history expansion
 History expansion assigns special meaning to the character @kbd{!}.
-@xref{Event Designators}, for more details.
+@ifset have-readline-appendices
+@xref{Event Designators}.
+@end ifset
 
-@cindex history expansion, turn on/off
 Since @kbd{!} is also the logical not operator in C, history expansion
 is off by default. If you decide to enable history expansion with the
 @code{set history expansion on} command, you may sometimes need to
@@ -13477,12 +13126,19 @@
 @table @code
 @item set history expansion on
 @itemx set history expansion
-@kindex set history expansion
+@cindex history expansion
 Enable history expansion.  History expansion is off by default.
 
 @item set history expansion off
 Disable history expansion.
 
+The readline code comes with more complete documentation of
+editing and history expansion features.  Users unfamiliar with @sc{gnu} Emacs
+or @code{vi} may wish to read it.
+@ifset have-readline-appendices
+@xref{Command Line Editing}.
+@end ifset
+
 @c @group
 @kindex show history
 @item show history
@@ -20307,20 +19963,17 @@
 
 @item @code{O} --- reserved
 
-@item @code{p}@var{hex number of register} --- read register packet
+Reserved for future use.
+
+@item @code{p}@var{n@dots{}} --- read reg @strong{(reserved)}
 @cindex @code{p} packet
 
-@xref{read registers packet}, for a description of how the returned
-register value is encoded.
+@xref{write register packet}.
 
 Reply:
 @table @samp
-@item @var{XX@dots{}}
-the register's value
-@item E@var{NN}
-for an error
-@item
-Indicating an unrecognized @var{query}.
+@item @var{r@dots{}.}
+The hex encoded value of the register in target byte order.
 @end table
 
 @item @code{P}@var{n@dots{}}@code{=}@var{r@dots{}} --- write register
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 3c27769..bff7d15 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -84,7 +84,6 @@
 * Support Libraries::
 * Coding::
 * Porting GDB::
-* Versions and Branches::
 * Releasing GDB::
 * Testsuite::
 * Hints::
@@ -477,10 +476,9 @@
 two macros can use them for their internal purposes.
 
 @findex target_stopped_data_address
-@item target_stopped_data_address (@var{addr_p})
-If the inferior has some watchpoint that triggered, place the address
-associated with the watchpoint at the location pointed to by
-@var{addr_p} and return non-zero.  Otherwise, return zero.
+@item target_stopped_data_address ()
+If the inferior has some watchpoint that triggered, return the address
+associated with that watchpoint.  Otherwise, return zero.
 
 @findex HAVE_STEPPABLE_WATCHPOINT
 @item HAVE_STEPPABLE_WATCHPOINT
@@ -600,25 +598,15 @@
 processors.
 
 @findex i386_stopped_data_address
-@item i386_stopped_data_address (@var{addr_p})
-The target function
-@code{target_stopped_data_address} is set to call this function.
-This
+@item i386_stopped_data_address (void)
+The macros @code{STOPPED_BY_WATCHPOINT} and
+@code{target_stopped_data_address} are set to call this function.  The
+argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored.  This
 function examines the breakpoint condition bits in the DR6 Debug
 Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
 macro, and returns the address associated with the first bit that is
 set in DR6.
 
-@findex i386_stopped_by_watchpoint
-@item i386_stopped_by_watchpoint (void)
-The macro @code{STOPPED_BY_WATCHPOINT}
-is set to call this function.  The
-argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored.  This
-function examines the breakpoint condition bits in the DR6 Debug
-Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
-macro, and returns true if any bit is set.  Otherwise, false is
-returned.
-
 @findex i386_insert_watchpoint
 @findex i386_remove_watchpoint
 @item i386_insert_watchpoint (@var{addr}, @var{len}, @var{type})
@@ -666,7 +654,7 @@
 @item i386_stopped_by_hwbp (void)
 This function returns non-zero if the inferior has some watchpoint or
 hardware breakpoint that triggered.  It works like
-@code{i386_stopped_data_address}, except that it doesn't record the
+@code{i386_stopped_data_address}, except that it doesn't return the
 address whose watchpoint triggered.
 
 @findex i386_cleanup_dregs
@@ -5380,199 +5368,110 @@
 configuration.
 @end itemize
 
-@node Versions and Branches
-@chapter Versions and Branches
-
-@section Versions
-
-@value{GDBN}'s version is determined by the file
-@file{gdb/version.in} and takes one of the following forms:
-
-@table @asis
-@item @var{major}.@var{minor}
-@itemx @var{major}.@var{minor}.@var{patchlevel}
-an official release (e.g., 6.0 or 6.0.1)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD}
-a snapshot (e.g., 6.0.50_20020630)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}-@var{MM}-@var{DD}-cvs
-a @sc{cvs} check out (e.g., 6.0.90_2004-02-30-cvs)
-@item @var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD} (@var{vendor})
-a vendor specific release of @value{GDBN}, that while based on@*
-@var{major}.@var{minor}.@var{patchlevel}_@var{YYYY}@var{MM}@var{DD},
-may contain additional changes
-@end table
-
-@value{GDBN}'s mainline uses the @var{major} and @var{minor} version
-numbers from the most recent release branch, with a @var{patchlevel}
-of 50.  As each new release branch is created, the mainline
-@var{major} and @var{minor} version numbers are accordingly updated.
-
-@value{GDBN}'s release branch uses a similar, but slightly more
-complicated scheme.  When the branch is first cut, the mainline's
-@var{patchlevel} is changed to .90.  As draft releases are drawn from
-the branch, the @var{patchlevel} is incremented.  Once the first
-release (@var{major}.@var{minor}) has been made, the version prefix is
-updated to @var{major}.@var{minor}.0.90.  Follow on releases have an
-incremented @var{patchlevel}.
-
-If the previous @value{GDBN} version is 6.1 and the current version is
-6.2, then, substituting 6 for @var{major} and 1 or 2 for @var{minor},
-here's an illustration of a typical sequence:
-
-@smallexample
-     <HEAD>
-        |
-6.1.50_2002-03-02-cvs
-        |
-        +---------------------------.
-        |                    <gdb_6_2-branch>
-        |                           |
-6.2.50_2002-03-03-cvs        6.1.90 (draft #1)
-        |                           |
-6.2.50_2002-03-04-cvs        6.1.90_2002-03-04-cvs
-        |                           |
-6.2.50_2002-03-05-cvs        6.1.91 (draft #2)
-        |                           |
-6.2.50_2002-03-06-cvs        6.1.91_2002-03-06-cvs
-        |                           |
-6.2.50_2002-03-07-cvs        6.2 (release)
-        |                          |
-6.2.50_2002-03-08-cvs        6.2.0.90_2002-03-08-cvs
-        |                          |
-6.2.50_2002-03-09-cvs        6.2.1 (update)
-        |                           |
-6.2.50_2002-03-10-cvs         <branch closed>
-        |
-6.2.50_2002-03-11-cvs
-        |
-        +---------------------------.
-        |                     <gdb_6_3-branch>
-        |                           |
-6.3.50_2002-03-12-cvs        6.2.90 (draft #1)
-        |                           |
-@end smallexample
-
-@section Release Branches
-@cindex Release Branches
-
-@value{GDBN} draws a release series (6.2, 6.2.1, @dots{}) from a
-single release branch, and identifies that branch using the @sc{cvs}
-branch tags:
-
-@smallexample
-gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-branchpoint
-gdb_@var{major}_@var{minor}-branch
-gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-release
-@end smallexample
-
-@emph{Pragmatics: To help identify the date at which a branch or
-release is made, both the branchpoint and release tags include the
-date that they are cut (@var{YYYY}@var{MM}@var{DD}) in the tag.  The
-branch tag, denoting the head of the branch, does not need this.}
-
-@section Vendor Branches
-@cindex vendor branches
-
-To avoid version conflicts, vendors are expected to modify the file
-@file{gdb/version.in} to include a vendor unique alphabetic identifier
-(an official @value{GDBN} release never uses alphabetic characters in
-its version identifer).  E.g., @samp{6.2widgit2}, or @samp{6.2 (Widgit
-Inc Patch 2)}.
-
-@section Experimental Branches
-@cindex experimental branches
-
-@subsection Guidelines
-
-@value{GDBN} permits the creation of branches, cut from the @sc{cvs}
-repository, for experimental development.  Branches make it possible
-for developers to share preliminary work, and maintainers to examine
-significant new developments.
-
-The following are a set of guidelines for creating such branches:
-
-@table @emph
-
-@item a branch has an owner
-The owner can set further policy for a branch, but may not change the
-ground rules.  In particular, they can set a policy for commits (be it
-adding more reviewers or deciding who can commit).
-
-@item all commits are posted
-All changes committed to a branch shall also be posted to
-@email{gdb-patches@@sources.redhat.com, the @value{GDBN} patches
-mailing list}.  While commentary on such changes are encouraged, people
-should remember that the changes only apply to a branch.
-
-@item all commits are covered by an assignment
-This ensures that all changes belong to the Free Software Foundation,
-and avoids the possibility that the branch may become contaminated.
-
-@item a branch is focused
-A focused branch has a single objective or goal, and does not contain
-unnecessary or irrelevant changes.  Cleanups, where identified, being
-be pushed into the mainline as soon as possible.
-
-@item a branch tracks mainline
-This keeps the level of divergence under control.  It also keeps the
-pressure on developers to push cleanups and other stuff into the
-mainline.
-
-@item a branch shall contain the entire @value{GDBN} module
-The @value{GDBN} module @code{gdb} should be specified when creating a
-branch (branches of individual files should be avoided).  @xref{Tags}.
-
-@item a branch shall be branded using @file{version.in}
-The file @file{gdb/version.in} shall be modified so that it identifies
-the branch @var{owner} and branch @var{name}, e.g.,
-@samp{6.2.50_20030303_owner_name} or @samp{6.2 (Owner Name)}.
-
-@end table
-
-@subsection Tags
-@anchor{Tags}
-
-To simplify the identification of @value{GDBN} branches, the following
-branch tagging convention is strongly recommended:
-
-@table @code
-
-@item @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
-@itemx @var{owner}_@var{name}-@var{YYYYMMDD}-branch
-The branch point and corresponding branch tag.  @var{YYYYMMDD} is the
-date that the branch was created.  A branch is created using the
-sequence: @anchor{experimental branch tags}
-@smallexample
-cvs rtag @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint gdb
-cvs rtag -b -r @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint \
-   @var{owner}_@var{name}-@var{YYYYMMDD}-branch gdb
-@end smallexample
-
-@item @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
-The tagged point, on the mainline, that was used when merging the branch
-on @var{yyyymmdd}.  To merge in all changes since the branch was cut,
-use a command sequence like:
-@smallexample
-cvs rtag @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint gdb
-cvs update \
-   -j@var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
-   -j@var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
-@end smallexample
-@noindent
-Similar sequences can be used to just merge in changes since the last
-merge.
-
-@end table
-
-@noindent
-For further information on @sc{cvs}, see
-@uref{http://www.gnu.org/software/cvs/, Concurrent Versions System}.
- 
 @node Releasing GDB
 
 @chapter Releasing @value{GDBN}
 @cindex making a new release of gdb
 
+@section Versions and Branches
+
+@subsection Version Identifiers
+
+@value{GDBN}'s version is determined by the file @file{gdb/version.in}.
+
+@value{GDBN}'s mainline uses ISO dates to differentiate between
+versions.  The CVS repository uses @var{YYYY}-@var{MM}-@var{DD}-cvs
+while the corresponding snapshot uses @var{YYYYMMDD}.
+
+@value{GDBN}'s release branch uses a slightly more complicated scheme.
+When the branch is first cut, the mainline version identifier is
+prefixed with the @var{major}.@var{minor} from of the previous release
+series but with .90 appended.  As draft releases are drawn from the
+branch, the minor minor number (.90) is incremented.  Once the first
+release (@var{M}.@var{N}) has been made, the version prefix is updated
+to @var{M}.@var{N}.0.90 (dot zero, dot ninety).  Follow on releases have
+an incremented minor minor version number (.0).
+
+Using 5.1 (previous) and 5.2 (current), the example below illustrates a
+typical sequence of version identifiers:
+
+@table @asis
+@item 5.1.1
+final release from previous branch
+@item 2002-03-03-cvs
+main-line the day the branch is cut
+@item 5.1.90-2002-03-03-cvs
+corresponding branch version
+@item 5.1.91
+first draft release candidate
+@item 5.1.91-2002-03-17-cvs
+updated branch version
+@item 5.1.92
+second draft release candidate
+@item 5.1.92-2002-03-31-cvs
+updated branch version
+@item 5.1.93
+final release candidate (see below)
+@item 5.2
+official release
+@item 5.2.0.90-2002-04-07-cvs
+updated CVS branch version
+@item 5.2.1
+second official release
+@end table
+
+Notes:
+
+@itemize @bullet
+@item
+Minor minor minor draft release candidates such as 5.2.0.91 have been
+omitted from the example.  Such release candidates are, typically, never
+made.
+@item
+For 5.1.93 the bziped tar ball @file{gdb-5.1.93.tar.bz2} is just the
+official @file{gdb-5.2.tar} renamed and compressed.
+@end itemize
+
+To avoid version conflicts, vendors are expected to modify the file
+@file{gdb/version.in} to include a vendor unique alphabetic identifier
+(an official @value{GDBN} release never uses alphabetic characters in
+its version identifer).
+
+Since @value{GDBN} does not make minor minor minor releases (e.g.,
+5.1.0.1) the conflict between that and a minor minor draft release
+identifier (e.g., 5.1.0.90) is avoided.
+
+
+@subsection Branches
+
+@value{GDBN} draws a release series (5.2, 5.2.1, @dots{}) from a single
+release branch (gdb_5_2-branch).  Since minor minor minor releases
+(5.1.0.1) are not made, the need to branch the release branch is avoided
+(it also turns out that the effort required for such a a branch and
+release is significantly greater than the effort needed to create a new
+release from the head of the release branch).
+
+Releases 5.0 and 5.1 used branch and release tags of the form:
+
+@smallexample
+gdb_N_M-YYYY-MM-DD-branchpoint
+gdb_N_M-YYYY-MM-DD-branch
+gdb_M_N-YYYY-MM-DD-release
+@end smallexample
+
+Release 5.2 is trialing the branch and release tags:
+
+@smallexample
+gdb_N_M-YYYY-MM-DD-branchpoint
+gdb_N_M-branch
+gdb_M_N-YYYY-MM-DD-release
+@end smallexample
+
+@emph{Pragmatics: The branchpoint and release tags need to identify when
+a branch and release are made.  The branch tag, denoting the head of the
+branch, does not have this criteria.}
+
+
 @section Branch Commit Policy
 
 The branch commit policy is pretty slack.  @value{GDBN} releases 5.0,
diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo
index 4b019d3..a00bc80 100644
--- a/gdb/doc/stabs.texinfo
+++ b/gdb/doc/stabs.texinfo
@@ -422,33 +422,9 @@
 value of the symbol is the start address of the portion of the
 text section corresponding to that file.
 
-Some compilers use the desc field to indicate the language of the
-source file.  Sun's compilers started this usage, and the first
-constants are derived from their documentation.  Languages added
-by gcc/gdb start at 0x32 to avoid conflict with languages Sun may
-add in the future.  A desc field with a value 0 indicates that no
-language has been specified via this mechanism.
-
-@table @asis
-@item @code{N_SO_AS} (0x1)
-Assembly language
-@item @code{N_SO_C}  (0x2)
-K&R traditional C
-@item @code{N_SO_ANSI_C} (0x3)
-ANSI C
-@item @code{N_SO_CC}  (0x4)
-C++
-@item @code{N_SO_FORTRAN} (0x5)
-Fortran
-@item @code{N_SO_PASCAL} (0x6)
-Pascal
-@item @code{N_SO_FORTRAN90} (0x7)
-Fortran90
-@item @code{N_SO_OBJC} (0x32)
-Objective-C
-@item @code{N_SO_OBJCPLUS} (0x33)
-Objective-C++
-@end table
+With the Sun Solaris2 compiler, the desc field contains a
+source-language code.
+@c Do the debuggers use it?  What are the codes? -djm
 
 Some compilers (for example, GCC2 and SunOS4 @file{/bin/cc}) also
 include the directory in which the source was compiled, in a second
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 420bea0..e2caefe 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -169,8 +169,9 @@
   char *ranges_buffer;
   char *loc_buffer;
 
-  /* A list of all the compilation units.  This is used to locate
-     the target compilation unit of a particular reference.  */
+  /* A list of all the compilation units.  This will be set if and
+     only if we have encountered a compilation unit with inter-CU
+     references.  */
   struct dwarf2_per_cu_data **all_comp_units;
 
   /* The number of compilation units in ALL_COMP_UNITS.  */
@@ -257,11 +258,6 @@
     int base_known;
   };
 
-/* Fixed size for the DIE hash table.  */
-#ifndef REF_HASH_SIZE
-#define REF_HASH_SIZE 1021
-#endif
-
 /* Internal state when decoding a particular compilation unit.  */
 struct dwarf2_cu
 {
@@ -329,17 +325,6 @@
   /* How many compilation units ago was this CU last referenced?  */
   int last_used;
 
-  /* A hash table of die offsets for following references.  */
-  struct die_info *die_ref_table[REF_HASH_SIZE];
-
-  /* Full DIEs if read in.  */
-  struct die_info *dies;
-
-  /* A set of pointers to dwarf2_per_cu_data objects for compilation
-     units referenced by this one.  Only set during full symbol processing;
-     partial symbol tables do not have dependencies.  */
-  htab_t dependencies;
-
   /* Mark used when releasing cached dies.  */
   unsigned int mark : 1;
 
@@ -354,12 +339,6 @@
   unsigned int has_namespace_info : 1;
 };
 
-/* Persistent data held for a compilation unit, even when not
-   processing it.  We put a pointer to this structure in the
-   read_symtab_private field of the psymtab.  If we encounter
-   inter-compilation-unit references, we also maintain a sorted
-   list of all compilation units.  */
-
 struct dwarf2_per_cu_data
 {
   /* The start offset and length of this compilation unit.  2**31-1
@@ -379,10 +358,8 @@
      holds a map of DIE offsets to types.  It isn't always possible
      to reconstruct this information later, so we have to preserve
      it.  */
-  htab_t type_hash;
 
-  /* The partial symbol table associated with this compilation unit.  */
-  struct partial_symtab *psymtab;
+  htab_t type_hash;
 };
 
 /* The line number information for a compilation unit (found in the
@@ -574,6 +551,13 @@
 #define ATTR_ALLOC_CHUNK 4
 #endif
 
+/* A hash table of die offsets for following references.  */
+#ifndef REF_HASH_SIZE
+#define REF_HASH_SIZE 1021
+#endif
+
+static struct die_info *die_ref_table[REF_HASH_SIZE];
+
 /* Allocate fields for structs, unions and enums in this size.  */
 #ifndef DW_FIELD_ALLOC_CHUNK
 #define DW_FIELD_ALLOC_CHUNK 4
@@ -591,6 +575,19 @@
 				   decode_locdesc's return value is
 				   the register number.  */
 
+/* We put a pointer to this structure in the read_symtab_private field
+   of the psymtab.  */
+
+struct dwarf2_pinfo
+  {
+    /* Offset in .debug_info for this compilation unit. */
+
+    unsigned long dwarf_info_offset;
+  };
+
+#define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
+#define DWARF_INFO_OFFSET(p) (PST_PRIVATE(p)->dwarf_info_offset)
+
 /* FIXME: We might want to set this from BFD via bfd_arch_bits_per_byte,
    but this would require a corresponding change in unpack_field_as_long
    and friends.  */
@@ -644,17 +641,6 @@
     int nfnfields;
   };
 
-/* One item on the queue of compilation units to read in full symbols
-   for.  */
-struct dwarf2_queue_item
-{
-  struct dwarf2_per_cu_data *per_cu;
-  struct dwarf2_queue_item *next;
-};
-
-/* The current queue.  */
-static struct dwarf2_queue_item *dwarf2_queue, *dwarf2_queue_tail;
-
 /* Loaded secondary compilation units are kept in memory until they
    have not been referenced for the processing of this many
    compilation units.  Set this to zero to disable caching.  Cache
@@ -769,7 +755,8 @@
 			       bfd *, char *, struct dwarf2_cu *);
 
 static struct partial_die_info *find_partial_die (unsigned long,
-						  struct dwarf2_cu *);
+						  struct dwarf2_cu *,
+						  struct dwarf2_cu **);
 
 static void fixup_partial_die (struct partial_die_info *,
 			       struct dwarf2_cu *);
@@ -857,6 +844,10 @@
 static struct type *die_containing_type (struct die_info *,
 					 struct dwarf2_cu *);
 
+#if 0
+static struct type *type_at_offset (unsigned int, struct objfile *);
+#endif
+
 static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *);
 
 static void read_type_die (struct die_info *, struct dwarf2_cu *);
@@ -953,6 +944,8 @@
 
 static void free_die_list (struct die_info *);
 
+static struct cleanup *make_cleanup_free_die_list (struct die_info *);
+
 static void process_die (struct die_info *, struct dwarf2_cu *);
 
 static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
@@ -986,17 +979,16 @@
 
 static void dump_die_list (struct die_info *);
 
-static void store_in_ref_table (unsigned int, struct die_info *,
-				struct dwarf2_cu *);
+static void store_in_ref_table (unsigned int, struct die_info *);
+
+static void dwarf2_empty_hash_tables (void);
 
 static unsigned int dwarf2_get_ref_die_offset (struct attribute *,
 					       struct dwarf2_cu *);
 
 static int dwarf2_get_attr_constant_value (struct attribute *, int);
 
-static struct die_info *follow_die_ref (struct die_info *,
-					struct attribute *,
-					struct dwarf2_cu *);
+static struct die_info *follow_die_ref (unsigned int);
 
 static struct type *dwarf2_fundamental_type (struct objfile *, int,
 					     struct dwarf2_cu *);
@@ -1053,18 +1045,13 @@
 static void set_die_type (struct die_info *, struct type *,
 			  struct dwarf2_cu *);
 
+#if 0
 static void reset_die_and_siblings_types (struct die_info *,
 					  struct dwarf2_cu *);
+#endif
 
 static void create_all_comp_units (struct objfile *);
 
-static struct dwarf2_cu *load_full_comp_unit (struct dwarf2_per_cu_data *);
-
-static void process_full_comp_unit (struct dwarf2_per_cu_data *);
-
-static void dwarf2_add_dependence (struct dwarf2_cu *,
-				   struct dwarf2_per_cu_data *);
-
 static void dwarf2_mark (struct dwarf2_cu *);
 
 static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
@@ -1349,7 +1336,9 @@
 
   /* No private part is necessary for include psymtabs.  This property
      can be used to differentiate between such include psymtabs and
-     the regular ones.  */
+     the regular ones.  If it ever happens that a regular psymtab can
+     legitimally have a NULL private part, then we'll have to add a
+     dedicated field for that in the dwarf2_pinfo structure.  */
   subpst->read_symtab_private = NULL;
 }
 
@@ -1402,8 +1391,6 @@
      read_in_chain.  Make sure to free them when we're done.  */
   back_to = make_cleanup (free_cached_comp_units, NULL);
 
-  create_all_comp_units (objfile);
-
   /* Since the objects we're extracting from .debug_info vary in
      length, only the individual functions to extract them (like
      read_comp_unit_head and load_partial_die) can really know whether
@@ -1448,7 +1435,8 @@
       dwarf2_read_abbrevs (abfd, &cu);
       make_cleanup (dwarf2_free_abbrev_table, &cu);
 
-      this_cu = dwarf2_find_comp_unit (cu.header.offset, objfile);
+      if (cu.has_form_ref_addr && dwarf2_per_objfile->all_comp_units == NULL)
+	create_all_comp_units (objfile);
 
       /* Read the compilation unit die */
       abbrev = peek_die_abbrev (info_ptr, &bytes_read, &cu);
@@ -1468,31 +1456,39 @@
       if (comp_unit_die.dirname)
 	pst->dirname = xstrdup (comp_unit_die.dirname);
 
-      pst->read_symtab_private = (char *) this_cu;
-
+      pst->read_symtab_private = (char *)
+	obstack_alloc (&objfile->objfile_obstack, sizeof (struct dwarf2_pinfo));
+      DWARF_INFO_OFFSET (pst) = beg_of_comp_unit - dwarf2_per_objfile->info_buffer;
       baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
       /* Store the function that reads in the rest of the symbol table */
       pst->read_symtab = dwarf2_psymtab_to_symtab;
 
-      /* If this compilation unit was already read in, free the
-	 cached copy in order to read it in again.  This is
-	 necessary because we skipped some symbols when we first
-	 read in the compilation unit (see load_partial_dies).
-	 This problem could be avoided, but the benefit is
-	 unclear.  */
-      if (this_cu->cu != NULL)
-	free_one_cached_comp_unit (this_cu->cu);
+      if (dwarf2_per_objfile->all_comp_units != NULL)
+	{
+	  struct dwarf2_per_cu_data *per_cu;
 
-      cu.per_cu = this_cu;
+	  per_cu = dwarf2_find_comp_unit (cu.header.offset, objfile);
 
-      /* Note that this is a pointer to our stack frame, being
-	 added to a global data structure.  It will be cleaned up
-	 in free_stack_comp_unit when we finish with this
-	 compilation unit.  */
-      this_cu->cu = &cu;
+	  /* If this compilation unit was already read in, free the
+	     cached copy in order to read it in again.  This is
+	     necessary because we skipped some symbols when we first
+	     read in the compilation unit (see load_partial_dies).
+	     This problem could be avoided, but the benefit is
+	     unclear.  */
+	  if (per_cu->cu != NULL)
+	    free_one_cached_comp_unit (per_cu->cu);
 
-      this_cu->psymtab = pst;
+	  cu.per_cu = per_cu;
+
+	  /* Note that this is a pointer to our stack frame, being
+	     added to a global data structure.  It will be cleaned up
+	     in free_stack_comp_unit when we finish with this
+	     compilation unit.  */
+	  per_cu->cu = &cu;
+	}
+      else
+	cu.per_cu = NULL;
 
       /* Check if comp unit has_children.
          If so, read the rest of the partial symbols from this comp unit.
@@ -1782,13 +1778,15 @@
 {
   char *grandparent_scope;
   struct partial_die_info *parent, *real_pdi;
+  struct dwarf2_cu *spec_cu;
 
   /* We need to look at our parent DIE; if we have a DW_AT_specification,
      then this means the parent of the specification DIE.  */
 
   real_pdi = pdi;
+  spec_cu = cu;
   while (real_pdi->has_specification)
-    real_pdi = find_partial_die (real_pdi->spec_offset, cu);
+    real_pdi = find_partial_die (real_pdi->spec_offset, spec_cu, &spec_cu);
 
   parent = real_pdi->die_parent;
   if (parent == NULL)
@@ -1799,7 +1797,7 @@
 
   fixup_partial_die (parent, cu);
 
-  grandparent_scope = partial_die_parent_scope (parent, cu);
+  grandparent_scope = partial_die_parent_scope (parent, spec_cu);
 
   if (parent->tag == DW_TAG_namespace
       || parent->tag == DW_TAG_structure_type
@@ -2073,14 +2071,16 @@
 
       struct partial_die_info *child_pdi = struct_pdi->die_child;
       struct partial_die_info *real_pdi;
+      struct dwarf2_cu *spec_cu;
 
       /* If this DIE (this DIE's specification, if any) has a parent, then
 	 we should not do this.  We'll prepend the parent's fully qualified
          name when we create the partial symbol.  */
 
       real_pdi = struct_pdi;
+      spec_cu = cu;
       while (real_pdi->has_specification)
-	real_pdi = find_partial_die (real_pdi->spec_offset, cu);
+	real_pdi = find_partial_die (real_pdi->spec_offset, spec_cu, &spec_cu);
 
       if (real_pdi->die_parent != NULL)
 	return;
@@ -2321,10 +2321,6 @@
 	      gdb_flush (gdb_stdout);
 	    }
 
-	  /* Restore our global data.  */
-	  dwarf2_per_objfile = objfile_data (pst->objfile,
-					     dwarf2_objfile_data_key);
-
 	  psymtab_to_symtab_1 (pst);
 
 	  /* Finish up the debug error message.  */
@@ -2334,104 +2330,21 @@
     }
 }
 
-/* Add PER_CU to the queue.  */
-
-static void
-queue_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
-  struct dwarf2_queue_item *item;
-
-  per_cu->queued = 1;
-  item = xmalloc (sizeof (*item));
-  item->per_cu = per_cu;
-  item->next = NULL;
-
-  if (dwarf2_queue == NULL)
-    dwarf2_queue = item;
-  else
-    dwarf2_queue_tail->next = item;
-
-  dwarf2_queue_tail = item;
-}
-
-/* Process the queue.  */
-
-static void
-process_queue (struct objfile *objfile)
-{
-  struct dwarf2_queue_item *item, *next_item;
-
-  /* Initially, there is just one item on the queue.  Load its DIEs,
-     and the DIEs of any other compilation units it requires,
-     transitively.  */
-
-  for (item = dwarf2_queue; item != NULL; item = item->next)
-    {
-      /* Read in this compilation unit.  This may add new items to
-	 the end of the queue.  */
-      load_full_comp_unit (item->per_cu);
-
-      item->per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
-      dwarf2_per_objfile->read_in_chain = item->per_cu;
-
-      /* If this compilation unit has already had full symbols created,
-	 reset the TYPE fields in each DIE.  */
-      if (item->per_cu->psymtab->readin)
-	reset_die_and_siblings_types (item->per_cu->cu->dies,
-				      item->per_cu->cu);
-    }
-
-  /* Now everything left on the queue needs to be read in.  Process
-     them, one at a time, removing from the queue as we finish.  */
-  for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
-    {
-      if (!item->per_cu->psymtab->readin)
-	process_full_comp_unit (item->per_cu);
-
-      item->per_cu->queued = 0;
-      next_item = item->next;
-      xfree (item);
-    }
-
-  dwarf2_queue_tail = NULL;
-}
-
-/* Free all allocated queue entries.  This function only releases anything if
-   an error was thrown; if the queue was processed then it would have been
-   freed as we went along.  */
-
-static void
-dwarf2_release_queue (void *dummy)
-{
-  struct dwarf2_queue_item *item, *last;
-
-  item = dwarf2_queue;
-  while (item)
-    {
-      /* Anything still marked queued is likely to be in an
-	 inconsistent state, so discard it.  */
-      if (item->per_cu->queued)
-	{
-	  if (item->per_cu->cu != NULL)
-	    free_one_cached_comp_unit (item->per_cu->cu);
-	  item->per_cu->queued = 0;
-	}
-
-      last = item;
-      item = item->next;
-      xfree (last);
-    }
-
-  dwarf2_queue = dwarf2_queue_tail = NULL;
-}
-
-/* Read in full symbols for PST, and anything it depends on.  */
-
 static void
 psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
-  struct dwarf2_per_cu_data *per_cu;
+  struct objfile *objfile = pst->objfile;
+  bfd *abfd = objfile->obfd;
+  struct dwarf2_cu cu;
+  struct die_info *dies;
+  unsigned long offset;
+  CORE_ADDR lowpc, highpc;
+  struct die_info *child_die;
+  char *info_ptr;
+  struct symtab *symtab;
   struct cleanup *back_to;
+  struct attribute *attr;
+  CORE_ADDR baseaddr;
   int i;
 
   for (i = 0; i < pst->number_of_dependencies; i++)
@@ -2451,9 +2364,7 @@
         psymtab_to_symtab_1 (pst->dependencies[i]);
       }
 
-  per_cu = (struct dwarf2_per_cu_data *) pst->read_symtab_private;
-
-  if (per_cu == NULL)
+  if (pst->read_symtab_private == NULL)
     {
       /* It's an include file, no symbols to read for it.
          Everything is in the parent symtab.  */
@@ -2461,107 +2372,40 @@
       return;
     }
 
-  back_to = make_cleanup (dwarf2_release_queue, NULL);
-
-  queue_comp_unit (per_cu);
-
-  process_queue (pst->objfile);
-
-  /* Age the cache, releasing compilation units that have not
-     been used recently.  */
-  age_cached_comp_units ();
-
-  do_cleanups (back_to);
-}
-
-/* Load the DIEs associated with PST and PER_CU into memory.  */
-
-static struct dwarf2_cu *
-load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
-  struct partial_symtab *pst = per_cu->psymtab;
-  bfd *abfd = pst->objfile->obfd;
-  struct dwarf2_cu *cu;
-  unsigned long offset;
-  char *info_ptr;
-  struct cleanup *back_to, *free_cu_cleanup;
-  struct attribute *attr;
-  CORE_ADDR baseaddr;
+  dwarf2_per_objfile = objfile_data (pst->objfile, dwarf2_objfile_data_key);
 
   /* Set local variables from the partial symbol table info.  */
-  offset = per_cu->offset;
+  offset = DWARF_INFO_OFFSET (pst);
 
   info_ptr = dwarf2_per_objfile->info_buffer + offset;
-
-  cu = xmalloc (sizeof (struct dwarf2_cu));
-  memset (cu, 0, sizeof (struct dwarf2_cu));
-
-  /* If an error occurs while loading, release our storage.  */
-  free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);
-
-  cu->objfile = pst->objfile;
-
-  /* read in the comp_unit header  */
-  info_ptr = read_comp_unit_head (&cu->header, info_ptr, abfd);
-
-  /* Read the abbrevs for this compilation unit  */
-  dwarf2_read_abbrevs (abfd, cu);
-  back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
-
-  cu->header.offset = offset;
-
-  cu->per_cu = per_cu;
-  per_cu->cu = cu;
-
-  /* We use this obstack for block values in dwarf_alloc_block.  */
-  obstack_init (&cu->comp_unit_obstack);
-
-  cu->dies = read_comp_unit (info_ptr, abfd, cu);
-
-  /* We try not to read any attributes in this function, because not
-     all objfiles needed for references have been loaded yet, and symbol
-     table processing isn't initialized.  But we have to set the CU language,
-     or we won't be able to build types correctly.  */
-  attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
-  if (attr)
-    set_cu_language (DW_UNSND (attr), cu);
-  else
-    set_cu_language (language_minimal, cu);
-
-  do_cleanups (back_to);
-
-  /* We've successfully allocated this compilation unit.  Let our caller
-     clean it up when finished with it.  */
-  discard_cleanups (free_cu_cleanup);
-
-  return cu;
-}
-
-/* Generate full symbol information for PST and CU, whose DIEs have
-   already been loaded into memory.  */
-
-static void
-process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-{
-  struct partial_symtab *pst = per_cu->psymtab;
-  struct dwarf2_cu *cu = per_cu->cu;
-  struct objfile *objfile = pst->objfile;
-  bfd *abfd = objfile->obfd;
-  CORE_ADDR lowpc, highpc;
-  struct symtab *symtab;
-  struct cleanup *back_to;
-  struct attribute *attr;
-  CORE_ADDR baseaddr;
-
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
   /* We're in the global namespace.  */
   processing_current_prefix = "";
 
-  buildsym_init ();
-  back_to = make_cleanup (really_free_pendings, NULL);
+  memset (&cu, 0, sizeof (struct dwarf2_cu));
+  obstack_init (&cu.comp_unit_obstack);
+  back_to = make_cleanup (free_stack_comp_unit, &cu);
 
-  cu->list_in_scope = &file_symbols;
+  buildsym_init ();
+  make_cleanup (really_free_pendings, NULL);
+
+  cu.objfile = objfile;
+
+  /* read in the comp_unit header  */
+  info_ptr = read_comp_unit_head (&cu.header, info_ptr, abfd);
+
+  /* Read the abbrevs for this compilation unit  */
+  dwarf2_read_abbrevs (abfd, &cu);
+  make_cleanup (dwarf2_free_abbrev_table, &cu);
+
+  cu.header.offset = offset;
+
+  cu.list_in_scope = &file_symbols;
+
+  dies = read_comp_unit (info_ptr, abfd, &cu);
+
+  make_cleanup_free_die_list (dies);
 
   /* Find the base address of the compilation unit for range lists and
      location lists.  It will normally be specified by DW_AT_low_pc.
@@ -2569,32 +2413,32 @@
      DW_AT_entry_pc.  It's been removed, but GCC still uses this for
      compilation units with discontinuous ranges.  */
 
-  cu->header.base_known = 0;
-  cu->header.base_address = 0;
+  cu.header.base_known = 0;
+  cu.header.base_address = 0;
 
-  attr = dwarf2_attr (cu->dies, DW_AT_entry_pc, cu);
+  attr = dwarf2_attr (dies, DW_AT_entry_pc, &cu);
   if (attr)
     {
-      cu->header.base_address = DW_ADDR (attr);
-      cu->header.base_known = 1;
+      cu.header.base_address = DW_ADDR (attr);
+      cu.header.base_known = 1;
     }
   else
     {
-      attr = dwarf2_attr (cu->dies, DW_AT_low_pc, cu);
+      attr = dwarf2_attr (dies, DW_AT_low_pc, &cu);
       if (attr)
 	{
-	  cu->header.base_address = DW_ADDR (attr);
-	  cu->header.base_known = 1;
+	  cu.header.base_address = DW_ADDR (attr);
+	  cu.header.base_known = 1;
 	}
     }
 
   /* Do line number decoding in read_file_scope () */
-  process_die (cu->dies, cu);
+  process_die (dies, &cu);
 
   /* Some compilers don't define a DW_AT_high_pc attribute for the
      compilation unit.  If the DW_AT_high_pc is missing, synthesize
      it, by scanning the DIE's below the compilation unit.  */
-  get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
+  get_scope_pc_bounds (dies, &lowpc, &highpc, &cu);
 
   symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile));
 
@@ -2602,9 +2446,9 @@
      If the compilation is from a C file generated by language preprocessors,
      do not set the language if it was already deduced by start_subfile.  */
   if (symtab != NULL
-      && !(cu->language == language_c && symtab->language != language_c))
+      && !(cu.language == language_c && symtab->language != language_c))
     {
-      symtab->language = cu->language;
+      symtab->language = cu.language;
     }
   pst->symtab = symtab;
   pst->readin = 1;
@@ -4569,7 +4413,7 @@
       return;
     }
   type = die_type (die, cu);
-  ftype = make_function_type (type, (struct type **) 0);
+  ftype = lookup_function_type (type);
 
   /* All functions in C++ and Java have prototypes.  */
   attr = dwarf2_attr (die, DW_AT_prototyped, cu);
@@ -4766,9 +4610,6 @@
       low = 1;
     }
 
-  /* FIXME: For variable sized arrays either of these could be
-     a variable rather than a constant value.  We'll allow it,
-     but we don't know how to handle it.  */
   attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
   if (attr)
     low = dwarf2_get_attr_constant_value (attr, 0);
@@ -4814,6 +4655,10 @@
 static struct die_info *
 read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
 {
+  /* Reset die reference table; we are
+     building new ones now.  */
+  dwarf2_empty_hash_tables ();
+
   return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL);
 }
 
@@ -4834,7 +4679,7 @@
   int has_children;
 
   cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
-  store_in_ref_table (die->offset, die, cu);
+  store_in_ref_table (die->offset, die);
 
   if (has_children)
     {
@@ -4913,6 +4758,19 @@
     }
 }
 
+static void
+do_free_die_list_cleanup (void *dies)
+{
+  free_die_list (dies);
+}
+
+static struct cleanup *
+make_cleanup_free_die_list (struct die_info *dies)
+{
+  return make_cleanup (do_free_die_list_cleanup, dies);
+}
+
+
 /* Read the contents of the section at OFFSET and of size SIZE from the
    object file specified by OBJFILE into the objfile_obstack and return it.  */
 
@@ -5452,16 +5310,27 @@
 /* Find a partial DIE at OFFSET, which may or may not be in CU.  */
 
 static struct partial_die_info *
-find_partial_die (unsigned long offset, struct dwarf2_cu *cu)
+find_partial_die (unsigned long offset, struct dwarf2_cu *cu,
+		  struct dwarf2_cu **target_cu)
 {
   struct dwarf2_per_cu_data *per_cu;
 
   if (offset >= cu->header.offset
       && offset < cu->header.offset + cu->header.length)
-    return find_partial_die_in_comp_unit (offset, cu);
+    {
+      *target_cu = cu;
+      return find_partial_die_in_comp_unit (offset, cu);
+    }
 
   per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
 
+  /* If this offset isn't pointing into a known compilation unit,
+     the debug information is probably corrupted.  */
+  if (per_cu == NULL)
+    error ("Dwarf Error: could not find partial DIE containing "
+	   "offset 0x%lx [in module %s]",
+	   (long) offset, bfd_get_filename (cu->objfile->obfd));
+
   if (per_cu->cu == NULL)
     {
       load_comp_unit (per_cu, cu->objfile);
@@ -5470,6 +5339,7 @@
     }
 
   per_cu->cu->last_used = 0;
+  *target_cu = per_cu->cu;
   return find_partial_die_in_comp_unit (offset, per_cu->cu);
 }
 
@@ -5486,10 +5356,11 @@
   if (part_die->name == NULL && part_die->has_specification)
     {
       struct partial_die_info *spec_die;
+      struct dwarf2_cu *spec_cu;
 
-      spec_die = find_partial_die (part_die->spec_offset, cu);
+      spec_die = find_partial_die (part_die->spec_offset, cu, &spec_cu);
 
-      fixup_partial_die (spec_die, cu);
+      fixup_partial_die (spec_die, spec_cu);
 
       if (spec_die->name)
 	{
@@ -5563,38 +5434,6 @@
     {
       info_ptr = read_attribute (&die->attrs[i], &abbrev->attrs[i],
 				 abfd, info_ptr, cu);
-
-      /* If this attribute is an absolute reference to a different
-	 compilation unit, make sure that compilation unit is loaded
-	 also.  */
-      if (die->attrs[i].form == DW_FORM_ref_addr
-	  && (DW_ADDR (&die->attrs[i]) < cu->header.offset
-	      || (DW_ADDR (&die->attrs[i])
-		  >= cu->header.offset + cu->header.length)))
-	{
-	  struct dwarf2_per_cu_data *per_cu;
-	  per_cu = dwarf2_find_containing_comp_unit (DW_ADDR (&die->attrs[i]),
-						     cu->objfile);
-
-	  /* Mark the dependence relation so that we don't flush PER_CU
-	     too early.  */
-	  dwarf2_add_dependence (cu, per_cu);
-
-	  /* If it's already on the queue, we have nothing to do.  */
-	  if (per_cu->queued)
-	    continue;
-
-	  /* If the compilation unit is already loaded, just mark it as
-	     used.  */
-	  if (per_cu->cu != NULL)
-	    {
-	      per_cu->cu->last_used = 0;
-	      continue;
-	    }
-
-	  /* Add it to the queue.  */
-	  queue_comp_unit (per_cu);
-       }
     }
 
   *diep = die;
@@ -5691,24 +5530,23 @@
       info_ptr += bytes_read;
       break;
     case DW_FORM_ref1:
-      DW_ADDR (attr) = cu->header.offset + read_1_byte (abfd, info_ptr);
+      DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
       info_ptr += 1;
       break;
     case DW_FORM_ref2:
-      DW_ADDR (attr) = cu->header.offset + read_2_bytes (abfd, info_ptr);
+      DW_UNSND (attr) = read_2_bytes (abfd, info_ptr);
       info_ptr += 2;
       break;
     case DW_FORM_ref4:
-      DW_ADDR (attr) = cu->header.offset + read_4_bytes (abfd, info_ptr);
+      DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
       info_ptr += 4;
       break;
     case DW_FORM_ref8:
-      DW_ADDR (attr) = cu->header.offset + read_8_bytes (abfd, info_ptr);
+      DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
       info_ptr += 8;
       break;
     case DW_FORM_ref_udata:
-      DW_ADDR (attr) = (cu->header.offset
-			+ read_unsigned_leb128 (abfd, info_ptr, &bytes_read));
+      DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
       info_ptr += bytes_read;
       break;
     case DW_FORM_indirect:
@@ -6094,8 +5932,6 @@
       break;
     case DW_LANG_Ada83:
     case DW_LANG_Ada95:
-      cu->language = language_ada;
-      break;
     case DW_LANG_Cobol74:
     case DW_LANG_Cobol85:
     case DW_LANG_Pascal83:
@@ -6118,14 +5954,21 @@
   for (i = 0; i < die->num_attrs; ++i)
     {
       if (die->attrs[i].name == name)
-	return &die->attrs[i];
+	{
+	  return &die->attrs[i];
+	}
       if (die->attrs[i].name == DW_AT_specification
 	  || die->attrs[i].name == DW_AT_abstract_origin)
 	spec = &die->attrs[i];
     }
-
   if (spec)
-    return dwarf2_attr (follow_die_ref (die, spec, cu), name, cu);
+    {
+      struct die_info *ref_die =
+      follow_die_ref (dwarf2_get_ref_die_offset (spec, cu));
+
+      if (ref_die)
+	return dwarf2_attr (ref_die, name, cu);
+    }
 
   return NULL;
 }
@@ -6167,7 +6010,7 @@
   if (spec_attr == NULL)
     return NULL;
   else
-    return follow_die_ref (die, spec_attr, cu);
+    return follow_die_ref (dwarf2_get_ref_die_offset (spec_attr, cu));
 }
 
 /* Free the line_header structure *LH, and any arrays and strings it
@@ -7098,6 +6941,7 @@
   struct type *type;
   struct attribute *type_attr;
   struct die_info *type_die;
+  unsigned int ref;
 
   type_attr = dwarf2_attr (die, DW_AT_type, cu);
   if (!type_attr)
@@ -7106,8 +6950,16 @@
       return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu);
     }
   else
-    type_die = follow_die_ref (die, type_attr, cu);
-
+    {
+      ref = dwarf2_get_ref_die_offset (type_attr, cu);
+      type_die = follow_die_ref (ref);
+      if (!type_die)
+	{
+	  error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", 
+			  ref, cu->objfile->name);
+	  return NULL;
+	}
+    }
   type = tag_type_to_type (type_die, cu);
   if (!type)
     {
@@ -7127,11 +6979,19 @@
   struct type *type = NULL;
   struct attribute *type_attr;
   struct die_info *type_die = NULL;
+  unsigned int ref;
 
   type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
   if (type_attr)
     {
-      type_die = follow_die_ref (die, type_attr, cu);
+      ref = dwarf2_get_ref_die_offset (type_attr, cu);
+      type_die = follow_die_ref (ref);
+      if (!type_die)
+	{
+	  error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", ref, 
+			  cu->objfile->name);
+	  return NULL;
+	}
       type = tag_type_to_type (type_die, cu);
     }
   if (!type)
@@ -7144,6 +7004,24 @@
   return type;
 }
 
+#if 0
+static struct type *
+type_at_offset (unsigned int offset, struct dwarf2_cu *cu)
+{
+  struct die_info *die;
+  struct type *type;
+
+  die = follow_die_ref (offset);
+  if (!die)
+    {
+      error ("Dwarf Error: Cannot find type referent at offset %d.", offset);
+      return NULL;
+    }
+  type = tag_type_to_type (die, cu);
+  return type;
+}
+#endif
+
 static struct type *
 tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu)
 {
@@ -7497,12 +7375,21 @@
 dwarf2_extension (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct attribute *attr;
+  struct die_info *extension_die;
+  unsigned int ref;
 
   attr = dwarf2_attr (die, DW_AT_extension, cu);
   if (attr == NULL)
     return NULL;
 
-  return follow_die_ref (die, attr, cu);
+  ref = dwarf2_get_ref_die_offset (attr, cu);
+  extension_die = follow_die_ref (ref);
+  if (!extension_die)
+    {
+      error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+    }
+
+  return extension_die;
 }
 
 /* Convert a DIE tag into its string name.  */
@@ -8339,16 +8226,13 @@
 	case DW_FORM_block1:
 	  fprintf_unfiltered (gdb_stderr, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
 	  break;
-	case DW_FORM_ref1:
-	case DW_FORM_ref2:
-	case DW_FORM_ref4:
-	  fprintf_unfiltered (gdb_stderr, "constant ref: %ld (adjusted)",
-			      (long) (DW_ADDR (&die->attrs[i])));
-	  break;
 	case DW_FORM_data1:
 	case DW_FORM_data2:
 	case DW_FORM_data4:
 	case DW_FORM_data8:
+	case DW_FORM_ref1:
+	case DW_FORM_ref2:
+	case DW_FORM_ref4:
 	case DW_FORM_udata:
 	case DW_FORM_sdata:
 	  fprintf_unfiltered (gdb_stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
@@ -8392,16 +8276,22 @@
 }
 
 static void
-store_in_ref_table (unsigned int offset, struct die_info *die,
-		    struct dwarf2_cu *cu)
+store_in_ref_table (unsigned int offset, struct die_info *die)
 {
   int h;
   struct die_info *old;
 
   h = (offset % REF_HASH_SIZE);
-  old = cu->die_ref_table[h];
+  old = die_ref_table[h];
   die->next_ref = old;
-  cu->die_ref_table[h] = die;
+  die_ref_table[h] = die;
+}
+
+
+static void
+dwarf2_empty_hash_tables (void)
+{
+  memset (die_ref_table, 0, sizeof (die_ref_table));
 }
 
 static unsigned int
@@ -8412,12 +8302,14 @@
   switch (attr->form)
     {
     case DW_FORM_ref_addr:
+      result = DW_ADDR (attr);
+      break;
     case DW_FORM_ref1:
     case DW_FORM_ref2:
     case DW_FORM_ref4:
     case DW_FORM_ref8:
     case DW_FORM_ref_udata:
-      result = DW_ADDR (attr);
+      result = cu->header.offset + DW_UNSND (attr);
       break;
     default:
       complaint (&symfile_complaints,
@@ -8450,41 +8342,21 @@
 }
 
 static struct die_info *
-follow_die_ref (struct die_info *src_die, struct attribute *attr,
-		struct dwarf2_cu *cu)
+follow_die_ref (unsigned int offset)
 {
   struct die_info *die;
-  unsigned int offset;
   int h;
-  struct die_info temp_die;
-  struct dwarf2_cu *target_cu;
-
-  offset = dwarf2_get_ref_die_offset (attr, cu);
-
-  if (DW_ADDR (attr) < cu->header.offset
-      || DW_ADDR (attr) >= cu->header.offset + cu->header.length)
-    {
-      struct dwarf2_per_cu_data *per_cu;
-      per_cu = dwarf2_find_containing_comp_unit (DW_ADDR (attr),
-						 cu->objfile);
-      target_cu = per_cu->cu;
-    }
-  else
-    target_cu = cu;
 
   h = (offset % REF_HASH_SIZE);
-  die = target_cu->die_ref_table[h];
+  die = die_ref_table[h];
   while (die)
     {
       if (die->offset == offset)
-	return die;
+	{
+	  return die;
+	}
       die = die->next_ref;
     }
-
-  error ("Dwarf Error: Cannot find DIE at 0x%lx referenced from DIE "
-	 "at 0x%lx [in module %s]",
-	 (long) src_die->offset, (long) offset, cu->objfile->name);
-
   return NULL;
 }
 
@@ -9214,7 +9086,7 @@
 }
 
 /* Locate the compilation unit from CU's objfile which contains the
-   DIE at OFFSET.  Raises an error on failure.  */
+   DIE at OFFSET.  Returns NULL on failure.  */
 
 static struct dwarf2_per_cu_data *
 dwarf2_find_containing_comp_unit (unsigned long offset,
@@ -9223,6 +9095,11 @@
   struct dwarf2_per_cu_data *this_cu;
   int low, high;
 
+  if (dwarf2_per_objfile->all_comp_units == NULL)
+    error ("Dwarf Error: offset 0x%lx points outside this "
+	   "compilation unit [in module %s]",
+	   offset, bfd_get_filename (objfile->obfd));
+
   low = 0;
   high = dwarf2_per_objfile->n_comp_units - 1;
   while (high > low)
@@ -9236,11 +9113,7 @@
   gdb_assert (low == high);
   if (dwarf2_per_objfile->all_comp_units[low]->offset > offset)
     {
-      if (low == 0)
-	error ("Dwarf Error: could not find partial DIE containing "
-	       "offset 0x%lx [in module %s]",
-	       (long) offset, bfd_get_filename (objfile->obfd));
-
+      gdb_assert (low > 0);
       gdb_assert (dwarf2_per_objfile->all_comp_units[low-1]->offset <= offset);
       return dwarf2_per_objfile->all_comp_units[low-1];
     }
@@ -9255,9 +9128,6 @@
     }
 }
 
-/* Locate the compilation unit from OBJFILE which is located at exactly
-   OFFSET.  Raises an error on failure.  */
-
 static struct dwarf2_per_cu_data *
 dwarf2_find_comp_unit (unsigned long offset, struct objfile *objfile)
 {
@@ -9282,8 +9152,6 @@
   cu->per_cu = NULL;
 
   obstack_free (&cu->comp_unit_obstack, NULL);
-  if (cu->dies)
-    free_die_list (cu->dies);
 
   xfree (cu);
 }
@@ -9464,6 +9332,8 @@
   **slot = ofs;
 }
 
+#if 0
+
 /* Find the type for DIE in TYPE_HASH, or return NULL if DIE does not
    have a saved type.  */
 
@@ -9499,56 +9369,17 @@
     }
 }
 
-/* Set the mark field in CU and in every other compilation unit in the
-   cache that we must keep because we are keeping CU.  */
-
-/* Add a dependence relationship from CU to REF_PER_CU.  */
-
-static void
-dwarf2_add_dependence (struct dwarf2_cu *cu,
-		       struct dwarf2_per_cu_data *ref_per_cu)
-{
-  void **slot;
-
-  if (cu->dependencies == NULL)
-    cu->dependencies
-      = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
-			      NULL, &cu->comp_unit_obstack,
-			      hashtab_obstack_allocate,
-			      dummy_obstack_deallocate);
-
-  slot = htab_find_slot (cu->dependencies, ref_per_cu, INSERT);
-  if (*slot == NULL)
-    *slot = ref_per_cu;
-}
+#endif
 
 /* Set the mark field in CU and in every other compilation unit in the
    cache that we must keep because we are keeping CU.  */
 
-static int
-dwarf2_mark_helper (void **slot, void *data)
-{
-  struct dwarf2_per_cu_data *per_cu;
-
-  per_cu = (struct dwarf2_per_cu_data *) *slot;
-  if (per_cu->cu->mark)
-    return 1;
-  per_cu->cu->mark = 1;
-
-  if (per_cu->cu->dependencies != NULL)
-    htab_traverse (per_cu->cu->dependencies, dwarf2_mark_helper, NULL);
-
-  return 1;
-}
-
 static void
 dwarf2_mark (struct dwarf2_cu *cu)
 {
   if (cu->mark)
     return;
   cu->mark = 1;
-  if (cu->dependencies != NULL)
-    htab_traverse (cu->dependencies, dwarf2_mark_helper, NULL);
 }
 
 static void
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 39d52fe..01f1f51 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -855,11 +855,15 @@
 	}
 
       if (c == '\n')
+#ifndef CRLF_SOURCE_FILES
+	break;
+#else
 	{
 	  if (input_index > 0 && result[input_index - 1] == '\r')
 	    input_index--;
 	  break;
 	}
+#endif
 
       result[input_index++] = c;
       while (input_index >= result_size)
diff --git a/gdb/exec.c b/gdb/exec.c
index f3246ca..7eaa15a 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -699,7 +699,7 @@
   exec_ops.to_open = exec_open;
   exec_ops.to_close = exec_close;
   exec_ops.to_attach = find_default_attach;
-  exec_ops.deprecated_xfer_memory = xfer_memory;
+  exec_ops.to_xfer_memory = xfer_memory;
   exec_ops.to_files_info = exec_files_info;
   exec_ops.to_insert_breakpoint = ignore;
   exec_ops.to_remove_breakpoint = ignore;
diff --git a/gdb/fbsd-proc.c b/gdb/fbsd-proc.c
new file mode 100644
index 0000000..f021d27
--- /dev/null
+++ b/gdb/fbsd-proc.c
@@ -0,0 +1,181 @@
+/* FreeBSD-specific methods for using the /proc file system.
+
+   Copyright 2002, 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "regset.h"
+
+#include "gdb_assert.h"
+#include "gdb_string.h"
+#include <sys/procfs.h>
+#include <sys/types.h>
+
+#include "elf-bfd.h"
+
+char *
+child_pid_to_exec_file (int pid)
+{
+  char *path;
+  char *buf;
+
+  path = xstrprintf ("/proc/%d/file", pid);
+  buf = xcalloc (MAXPATHLEN, sizeof (char));
+  make_cleanup (xfree, path);
+  make_cleanup (xfree, buf);
+
+  if (readlink (path, buf, MAXPATHLEN) > 0)
+    return buf;
+
+  return NULL;
+}
+
+static int
+read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
+	      char *protection)
+{
+  /* FreeBSD 5.1-RELEASE uses a 256-byte buffer.  */
+  char buf[256];
+  int resident, privateresident;
+  unsigned long obj;
+  int ret = EOF;
+
+  /* As of FreeBSD 5.0-RELEASE, the layout is described in
+     /usr/src/sys/fs/procfs/procfs_map.c.  Somewhere in 5.1-CURRENT a
+     new column was added to the procfs map.  Therefore we can't use
+     fscanf since we need to support older releases too.  */
+  if (fgets (buf, sizeof buf, mapfile) != NULL)
+    ret = sscanf (buf, "%lx %lx %d %d %lx %s", start, end,
+		  &resident, &privateresident, &obj, protection);
+
+  return (ret != 0 && ret != EOF);
+}
+
+static int
+fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
+				       int, int, int, void *),
+			  void *obfd)
+{
+  pid_t pid = ptid_get_pid (inferior_ptid);
+  char *mapfilename;
+  FILE *mapfile;
+  unsigned long start, end, size;
+  char protection[4];
+  int read, write, exec;
+
+  mapfilename = xstrprintf ("/proc/%ld/map", (long) pid);
+  mapfile = fopen (mapfilename, "r");
+  if (mapfile == NULL)
+    error ("Couldn't open %s\n", mapfilename);
+
+  if (info_verbose)
+    fprintf_filtered (gdb_stdout, 
+		      "Reading memory regions from %s\n", mapfilename);
+
+  /* Now iterate until end-of-file.  */
+  while (read_mapping (mapfile, &start, &end, &protection[0]))
+    {
+      size = end - start;
+
+      read = (strchr (protection, 'r') != 0);
+      write = (strchr (protection, 'w') != 0);
+      exec = (strchr (protection, 'x') != 0);
+
+      if (info_verbose)
+	{
+	  fprintf_filtered (gdb_stdout, 
+			    "Save segment, %ld bytes at 0x%s (%c%c%c)\n", 
+			    size, paddr_nz (start),
+			    read ? 'r' : '-',
+			    write ? 'w' : '-',
+			    exec ? 'x' : '-');
+	}
+
+      /* Invoke the callback function to create the corefile segment. */
+      func (start, size, read, write, exec, obfd);
+    }
+
+  fclose (mapfile);
+  return 0;
+}
+
+static char *
+fbsd_make_corefile_notes (bfd *obfd, int *note_size)
+{
+  struct gdbarch *gdbarch = current_gdbarch;
+  const struct regcache *regcache = current_regcache;
+  gregset_t gregs;
+  fpregset_t fpregs;
+  char *note_data = NULL;
+  Elf_Internal_Ehdr *i_ehdrp;
+  const struct regset *regset;
+  size_t size;
+
+  /* Put a "FreeBSD" label in the ELF header.  */
+  i_ehdrp = elf_elfheader (obfd);
+  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+
+  gdb_assert (gdbarch_regset_from_core_section_p (gdbarch));
+
+  size = sizeof gregs;
+  regset = gdbarch_regset_from_core_section (gdbarch, ".reg", size);
+  gdb_assert (regset && regset->collect_regset);
+  regset->collect_regset (regset, regcache, -1, &gregs, size);
+
+  note_data = elfcore_write_prstatus (obfd, note_data, note_size,
+				      ptid_get_pid (inferior_ptid),
+				      stop_signal, &gregs);
+
+  size = sizeof fpregs;
+  regset = gdbarch_regset_from_core_section (gdbarch, ".reg2", size);
+  gdb_assert (regset && regset->collect_regset);
+  regset->collect_regset (regset, regcache, -1, &fpregs, size);
+
+  note_data = elfcore_write_prfpreg (obfd, note_data, note_size,
+				     &fpregs, sizeof (fpregs));
+
+  if (get_exec_file (0))
+    {
+      char *fname = strrchr (get_exec_file (0), '/') + 1;
+      char *psargs = xstrdup (fname);
+
+      if (get_inferior_args ())
+	psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
+
+      note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
+					  fname, psargs);
+    }
+
+  make_cleanup (xfree, note_data);
+  return note_data;
+}
+
+
+void
+_initialize_fbsd_proc (void)
+{
+  extern void inftarg_set_find_memory_regions ();
+  extern void inftarg_set_make_corefile_notes ();
+
+  inftarg_set_find_memory_regions (fbsd_find_memory_regions);
+  inftarg_set_make_corefile_notes (fbsd_make_corefile_notes);
+}
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 90580ba..e1d32b0 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -1,8 +1,6 @@
 /* Fork a Unix child process, and set up to debug it, for GDB.
-
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
-   2000, 2001, 2004 Free Software Foundation, Inc.
-
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+   2001 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
    This file is part of GDB.
@@ -36,18 +34,19 @@
 
 #include <signal.h>
 
-/* This just gets used as a default if we can't find SHELL.  */
+/* This just gets used as a default if we can't find SHELL */
 #ifndef SHELL_FILE
 #define SHELL_FILE "/bin/sh"
 #endif
 
 extern char **environ;
 
-/* Break up SCRATCH into an argument vector suitable for passing to
-   execvp and store it in ARGV.  E.g., on "run a b c d" this routine
-   would get as input the string "a b c d", and as output it would
-   fill in ARGV with the four arguments "a", "b", "c", "d".  */
-
+/* This function breaks up an argument string into an argument
+ * vector suitable for passing to execvp().
+ * E.g., on "run a b c d" this routine would get as input
+ * the string "a b c d", and as output it would fill in argv with
+ * the four arguments "a", "b", "c", "d".
+ */
 static void
 breakup_args (char *scratch, char **argv)
 {
@@ -55,45 +54,49 @@
 
   for (;;)
     {
+
       /* Scan past leading separators */
       while (*cp == ' ' || *cp == '\t' || *cp == '\n')
-	cp++;
+	{
+	  cp++;
+	}
 
-      /* Break if at end of string.  */
+      /* Break if at end of string */
       if (*cp == '\0')
 	break;
 
-      /* Take an arg.  */
+      /* Take an arg */
       *argv++ = cp;
 
-      /* Scan for next arg separator.  */
+      /* Scan for next arg separator */
       cp = strchr (cp, ' ');
       if (cp == NULL)
 	cp = strchr (cp, '\t');
       if (cp == NULL)
 	cp = strchr (cp, '\n');
 
-      /* No separators => end of string => break.  */
+      /* No separators => end of string => break */
       if (cp == NULL)
 	break;
 
-      /* Replace the separator with a terminator.  */
+      /* Replace the separator with a terminator */
       *cp++ = '\0';
     }
 
-  /* Null-terminate the vector.  */
+  /* execv requires a null-terminated arg vector */
   *argv = NULL;
+
 }
 
-/* When executing a command under the given shell, return non-zero if
-   the '!' character should be escaped when embedded in a quoted
+/* When executing a command under the given shell, return non-zero
+   if the '!' character should be escaped when embedded in a quoted
    command-line argument.  */
 
 static int
 escape_bang_in_quoted_argument (const char *shell_file)
 {
   const int shell_file_len = strlen (shell_file);
-
+  
   /* Bang should be escaped only in C Shells.  For now, simply check
      that the shell name ends with 'csh', which covers at least csh
      and tcsh.  This should be good enough for now.  */
@@ -109,14 +112,14 @@
   return 0;
 }
 
-/* Start an inferior Unix child process and sets inferior_ptid to its
-   pid.  EXEC_FILE is the file to run.  ALLARGS is a string containing
-   the arguments to the program.  ENV is the environment vector to
-   pass.  SHELL_FILE is the shell file, or NULL if we should pick
-   one.  */
+/* Start an inferior Unix child process and sets inferior_ptid to its pid.
+   EXEC_FILE is the file to run.
+   ALLARGS is a string containing the arguments to the program.
+   ENV is the environment vector to pass.  SHELL_FILE is the shell file,
+   or NULL if we should pick one.  Errors reported with error().  */
 
-/* This function is NOT reentrant.  Some of the variables have been
-   made static to ensure that they survive the vfork call.  */
+/* This function is NOT-REENTRANT.  Some of the variables have been
+   made static to ensure that they survive the vfork() call.  */
 
 void
 fork_inferior (char *exec_file_arg, char *allargs, char **env,
@@ -138,19 +141,20 @@
   int shell = 0;
   static char **argv;
 
-  /* If no exec file handed to us, get it from the exec-file command
-     -- with a good, common error message if none is specified.  */
+  /* If no exec file handed to us, get it from the exec-file command -- with
+     a good, common error message if none is specified.  */
   exec_file = exec_file_arg;
   if (exec_file == 0)
     exec_file = get_exec_file (1);
 
-  /* STARTUP_WITH_SHELL is defined in inferior.h.  If 0,e we'll just
-    do a fork/exec, no shell, so don't bother figuring out what
-    shell.  */
+  /* STARTUP_WITH_SHELL is defined in inferior.h.
+   * If 0, we'll just do a fork/exec, no shell, so don't
+   * bother figuring out what shell.
+   */
   shell_file = shell_file_arg;
   if (STARTUP_WITH_SHELL)
     {
-      /* Figure out what shell to start up the user program under.  */
+      /* Figure out what shell to start up the user program under. */
       if (shell_file == NULL)
 	shell_file = getenv ("SHELL");
       if (shell_file == NULL)
@@ -158,9 +162,9 @@
       shell = 1;
     }
 
-  /* Multiplying the length of exec_file by 4 is to account for the
-     fact that it may expand when quoted; it is a worst-case number
-     based on every character being '.  */
+  /* Multiplying the length of exec_file by 4 is to account for the fact
+     that it may expand when quoted; it is a worst-case number based on
+     every character being '.  */
   len = 5 + 4 * strlen (exec_file) + 1 + strlen (allargs) + 1 + /*slop */ 12;
   /* If desired, concat something onto the front of ALLARGS.
      SHELL_COMMAND is the result.  */
@@ -174,18 +178,17 @@
 
   if (!shell)
     {
-      /* We're going to call execvp.  Create argument vector.
-	 Calculate an upper bound on the length of the vector by
-	 assuming that every other character is a separate
-	 argument.  */
-      int argc = (strlen (allargs) + 1) / 2 + 2;
-      argv = (char **) xmalloc (argc * sizeof (*argv));
+      /* We're going to call execvp. Create argv */
+      /* Largest case: every other character is a separate arg */
+      argv = (char **) xmalloc (((strlen (allargs) + 1) / (unsigned) 2 + 2) * sizeof (*argv));
       argv[0] = exec_file;
       breakup_args (allargs, &argv[1]);
+
     }
   else
     {
-      /* We're going to call a shell.  */
+
+      /* We're going to call a shell */
 
       /* Now add exec_file, quoting as necessary.  */
 
@@ -195,9 +198,9 @@
 
       strcat (shell_command, "exec ");
 
-      /* Quoting in this style is said to work with all shells.  But
-         csh on IRIX 4.0.1 can't deal with it.  So we only quote it if
-         we need to.  */
+      /* Quoting in this style is said to work with all shells.  But csh
+         on IRIX 4.0.1 can't deal with it.  So we only quote it if we need
+         to.  */
       p = exec_file;
       while (1)
 	{
@@ -248,29 +251,32 @@
 
       strcat (shell_command, " ");
       strcat (shell_command, allargs);
+
     }
 
-  /* On some systems an exec will fail if the executable is open.  */
+  /* exec is said to fail if the executable is open.  */
   close_exec_file ();
 
   /* Retain a copy of our environment variables, since the child will
-     replace the value of environ and if we're vforked, we have to
+     replace the value of  environ  and if we're vforked, we have to
      restore it.  */
   save_our_env = environ;
 
   /* Tell the terminal handling subsystem what tty we plan to run on;
      it will just record the information for later.  */
+
   new_tty_prefork (inferior_io_terminal);
 
   /* It is generally good practice to flush any possible pending stdio
-     output prior to doing a fork, to avoid the possibility of both
-     the parent and child flushing the same data after the fork. */
+     output prior to doing a fork, to avoid the possibility of both the
+     parent and child flushing the same data after the fork. */
+
   gdb_flush (gdb_stdout);
   gdb_flush (gdb_stderr);
 
-  /* If there's any initialization of the target layers that must
-     happen to prepare to handle the child we're about fork, do it
-     now...  */
+  /* If there's any initialization of the target layers that must happen
+     to prepare to handle the child we're about fork, do it now...
+   */
   if (pre_trace_fun != NULL)
     (*pre_trace_fun) ();
 
@@ -295,9 +301,9 @@
       if (debug_setpgrp == -1)
 	perror ("setpgrp failed in child");
 
-      /* Ask the tty subsystem to switch to the one we specified
-         earlier (or to share the current terminal, if none was
-         specified).  */
+      /* Ask the tty subsystem to switch to the one we specified earlier
+         (or to share the current terminal, if none was specified).  */
+
       new_tty ();
 
       /* Changing the signal handlers for the inferior after
@@ -308,15 +314,14 @@
 
       /* "Trace me, Dr. Memory!" */
       (*traceme_fun) ();
-
       /* The call above set this process (the "child") as debuggable
-        by the original gdb process (the "parent").  Since processes
-        (unlike people) can have only one parent, if you are debugging
-        gdb itself (and your debugger is thus _already_ the
-        controller/parent for this child), code from here on out is
-        undebuggable.  Indeed, you probably got an error message
-        saying "not parent".  Sorry; you'll have to use print
-        statements!  */
+       * by the original gdb process (the "parent").  Since processes
+       * (unlike people) can have only one parent, if you are
+       * debugging gdb itself (and your debugger is thus _already_ the
+       * controller/parent for this child),  code from here on out
+       * is undebuggable.  Indeed, you probably got an error message
+       * saying "not parent".  Sorry--you'll have to use print statements!
+       */
 
       /* There is no execlpe call, so we have to set the environment
          for our child in the global variable.  If we've vforked, this
@@ -325,17 +330,19 @@
          path to find $SHELL.  Rich Pixley says so, and I agree.  */
       environ = env;
 
-      /* If we decided above to start up with a shell, we exec the
-        shell, "-c" says to interpret the next arg as a shell command
-        to execute, and this command is "exec <target-program>
-        <args>".  "-f" means "fast startup" to the c-shell, which
-        means don't do .cshrc file. Doing .cshrc may cause fork/exec
-        events which will confuse debugger start-up code.  */
+      /* If we decided above to start up with a shell,
+       * we exec the shell,
+       * "-c" says to interpret the next arg as a shell command
+       * to execute, and this command is "exec <target-program> <args>".
+       * "-f" means "fast startup" to the c-shell, which means
+       * don't do .cshrc file. Doing .cshrc may cause fork/exec
+       * events which will confuse debugger start-up code.
+       */
       if (shell)
 	{
 	  execlp (shell_file, shell_file, "-c", shell_command, (char *) 0);
 
-	  /* If we get here, it's an error.  */
+	  /* If we get here, it's an error */
 	  fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,
 			      safe_strerror (errno));
 	  gdb_flush (gdb_stderr);
@@ -343,14 +350,13 @@
 	}
       else
 	{
-	  /* Otherwise, we directly exec the target program with
-	     execvp.  */
+	  /* Otherwise, we directly exec the target program with execvp. */
 	  int i;
 	  char *errstring;
 
 	  execvp (exec_file, argv);
 
-	  /* If we get here, it's an error.  */
+	  /* If we get here, it's an error */
 	  errstring = safe_strerror (errno);
 	  fprintf_unfiltered (gdb_stderr, "Cannot exec %s ", exec_file);
 
@@ -363,10 +369,9 @@
 	      i++;
 	    }
 	  fprintf_unfiltered (gdb_stderr, ".\n");
-#if 0
-	  /* This extra info seems to be useless.  */
-	  fprintf_unfiltered (gdb_stderr, "Got error %s.\n", errstring);
-#endif
+	  /* This extra info seems to be useless
+	     fprintf_unfiltered (gdb_stderr, "Got error %s.\n", errstring);
+	   */
 	  gdb_flush (gdb_stderr);
 	  _exit (0177);
 	}
@@ -377,21 +382,20 @@
 
   init_thread_list ();
 
-  /* Needed for wait_for_inferior stuff below.  */
-  inferior_ptid = pid_to_ptid (pid);
+  inferior_ptid = pid_to_ptid (pid);	/* Needed for wait_for_inferior stuff below */
 
   /* Now that we have a child process, make it our target, and
-     initialize anything target-vector-specific that needs
-     initializing.  */
+     initialize anything target-vector-specific that needs initializing.  */
+
   (*init_trace_fun) (pid);
 
   /* We are now in the child process of interest, having exec'd the
      correct program, and are poised at the first instruction of the
      new program.  */
 
-  /* Allow target dependent code to play with the new process.  This
-     might be used to have target-specific code initialize a variable
-     in the new process prior to executing the first instruction.  */
+  /* Allow target dependent code to play with the new process.  This might be
+     used to have target-specific code initialize a variable in the new process
+     prior to executing the first instruction.  */
   TARGET_CREATE_INFERIOR_HOOK (pid);
 
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
@@ -405,16 +409,18 @@
 startup_inferior (int ntraps)
 {
   int pending_execs = ntraps;
-  int terminal_initted = 0;
+  int terminal_initted;
 
-  /* The process was started by the fork that created it, but it will
-     have stopped one instruction after execing the shell.  Here we
-     must get it up to actual execution of the real program.  */
+  /* The process was started by the fork that created it,
+     but it will have stopped one instruction after execing the shell.
+     Here we must get it up to actual execution of the real program.  */
 
   clear_proceed_status ();
 
   init_wait_for_inferior ();
 
+  terminal_initted = 0;
+
   if (STARTUP_WITH_SHELL)
     inferior_ignoring_startup_exec_events = ntraps;
   else
@@ -424,14 +430,13 @@
 
   while (1)
     {
-      /* Make wait_for_inferior be quiet. */
+      /* Make wait_for_inferior be quiet */
       stop_soon = STOP_QUIETLY;
       wait_for_inferior ();
       if (stop_signal != TARGET_SIGNAL_TRAP)
 	{
-	  /* Let shell child handle its own signals in its own way.
-	     FIXME: what if child has exited?  Must exit loop
-	     somehow.  */
+	  /* Let shell child handle its own signals in its own way */
+	  /* FIXME, what if child has exit()ed?  Must exit loop somehow */
 	  resume (0, stop_signal);
 	}
       else
@@ -439,10 +444,9 @@
 	  /* We handle SIGTRAP, however; it means child did an exec.  */
 	  if (!terminal_initted)
 	    {
-	      /* Now that the child has exec'd we know it has already
-	         set its process group.  On POSIX systems, tcsetpgrp
-	         will fail with EPERM if we try it before the child's
-	         setpgid.  */
+	      /* Now that the child has exec'd we know it has already set its
+	         process group.  On POSIX systems, tcsetpgrp will fail with
+	         EPERM if we try it before the child's setpgid.  */
 
 	      /* Set up the "saved terminal modes" of the inferior
 	         based on what modes we are starting it with.  */
@@ -454,10 +458,11 @@
 	      terminal_initted = 1;
 	    }
 
-	  if (--pending_execs == 0)
+	  pending_execs = pending_execs - 1;
+	  if (0 == pending_execs)
 	    break;
 
-	  resume (0, TARGET_SIGNAL_0);	/* Just make it go on.  */
+	  resume (0, TARGET_SIGNAL_0);	/* Just make it go on */
 	}
     }
   stop_soon = NO_STOP_QUIETLY;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 30e1928..7bc09f0 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1293,8 +1293,8 @@
 }
 
 
-int
-frv_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+frv_stopped_data_address (void)
 {
   CORE_ADDR brr, dbar0, dbar1, dbar2, dbar3;
 
@@ -1305,24 +1305,15 @@
   dbar3 = read_register (dbar3_regnum);
 
   if (brr & (1<<11))
-    *addr_p = dbar0;
+    return dbar0;
   else if (brr & (1<<10))
-    *addr_p = dbar1;
+    return dbar1;
   else if (brr & (1<<9))
-    *addr_p = dbar2;
+    return dbar2;
   else if (brr & (1<<8))
-    *addr_p = dbar3;
+    return dbar3;
   else
     return 0;
-
-  return 1;
-}
-
-int
-frv_have_stopped_data_address (void)
-{
-  CORE_ADDR addr = 0;
-  return frv_stopped_data_address (&addr);
 }
 
 static CORE_ADDR
diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh
index 41b95d2..b210161 100755
--- a/gdb/gdb_indent.sh
+++ b/gdb/gdb_indent.sh
@@ -77,7 +77,6 @@
 -T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
 -T td_thrhandle_t -T td_event_msg_t -T td_thr_events_t \
 -T td_notify_t -T td_thr_iter_f -T td_thrinfo_t \
--T caddr_t \
 `cat *.h | sed -n \
     -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
     -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 0a28534..81dd0a0 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -292,7 +292,7 @@
   intptr_t ti_sp;			/* Unused.  */
   short int ti_flags;			/* Unused.  */
   int ti_pri;				/* Thread priority.  */
-  lwpid_t ti_lid;			/* Kernel pid for this thread.  */
+  lwpid_t ti_lid;			/* Unused.  */
   sigset_t ti_sigmask;			/* Signal mask.  */
   unsigned char ti_traceme;		/* Nonzero if event reporting
 					   enabled.  */
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 96df7e5..0095e5f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,32 +1,3 @@
-2004-10-16  Daniel Jacobowitz  <dan@debian.org>
-
-	* linux-i386-low.c (ps_get_thread_area): New.
-	* linux-x86-64-low.c (ps_get_thread_area): New.
-	* linux-low.c: Include <sys/syscall.h>.
-	(linux_kill_one_process): Don't kill the first thread here.
-	(linux_kill): Kill the first thread here.
-	(kill_lwp): New function.
-	(send_sigstop, linux_send_signal): Use it.
-	* proc-service.c: Clean up #ifdefs.
-	(fpregset_info): Delete.
-	(ps_lgetregs): Update and enable implementation.
-	(ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Remove disabled
-	implementations.
-	* remote-utils.c (struct sym_cache, symbol_cache): New.
-	(input_interrupt): Print a clearer message.
-	(async_io_enabled): New variable.
-	(enable_async_io, disable_async_io): Use it.  Update comments.
-	(look_up_one_symbol): Use the symbol cache.
-	* thread-db.c (thread_db_look_up_symbols): New function.
-	(thread_db_init): Update comments.  Call thread_db_look_up_symbols.
-
-2004-10-16  Daniel Jacobowitz  <dan@debian.org>
-
-	* configure.in: Test for -rdynamic.
-	* configure: Regenerated.
-	* Makefile (INTERNAL_LDFLAGS): New.
-	(gdbserver, gdbreplay): Use it.
-
 2004-09-02  Andrew Cagney  <cagney@gnu.org>
 
 	* Makefile.in (TAGS): Replace TM_FILE with DEPRECATED_TM_FILE.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 7123761..a5c1f95 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -103,7 +103,6 @@
 # LDFLAGS is specifically reserved for setting from the command line
 # when running make.
 LDFLAGS = @LDFLAGS@
-INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
 
 # Perhaps should come from parent Makefile
 VERSION = gdbserver-4.12.3
@@ -172,12 +171,12 @@
 
 gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS}
 	rm -f gdbserver
-	${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
+	${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbserver $(OBS) \
 	  $(GDBSERVER_LIBS) $(XM_CLIBS)
 
 gdbreplay: gdbreplay.o
 	rm -f gdbreplay
-	${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
+	${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbreplay gdbreplay.o \
 	  $(XM_CLIBS)
 
 # Put the proper machine-specific files first, so M-. on a machine
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 0bcefd6..62d3785 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1582,28 +1582,6 @@
   else
     srv_libs="$srv_cv_thread_db"
   fi
-  old_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -rdynamic"
-  cat > conftest.$ac_ext <<EOF
-#line 1589 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  RDYNAMIC=-rdynamic
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  RDYNAMIC=
-fi
-rm -f conftest*
-  
-  LDFLAGS="$old_LDFLAGS"
 fi
 
 if test "$srv_linux_thread_db" = "yes"; then
@@ -1771,7 +1749,6 @@
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@CPP@%$CPP%g
-s%@RDYNAMIC@%$RDYNAMIC%g
 s%@GDBSERVER_DEPFILES@%$GDBSERVER_DEPFILES%g
 s%@GDBSERVER_LIBS@%$GDBSERVER_LIBS%g
 s%@USE_THREAD_DB@%$USE_THREAD_DB%g
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index 027699a..a5a34df 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -1,5 +1,5 @@
 dnl Autoconf configure script for GDB server.
-dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl Copyright 2000, 2002 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
 dnl
@@ -114,11 +114,6 @@
   else
     srv_libs="$srv_cv_thread_db"
   fi
-  old_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -rdynamic"
-  AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
-  AC_SUBST(RDYNAMIC)
-  LDFLAGS="$old_LDFLAGS"
 fi
 
 if test "$srv_linux_thread_db" = "yes"; then
diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c
index d8cc4ec..b79b601 100644
--- a/gdb/gdbserver/linux-i386-low.c
+++ b/gdb/gdbserver/linux-i386-low.c
@@ -1,5 +1,5 @@
 /* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -23,30 +23,10 @@
 #include "linux-low.h"
 #include "i387-fp.h"
 
-/* Correct for all GNU/Linux targets (for quite some time).  */
-#define GDB_GREGSET_T elf_gregset_t
-#define GDB_FPREGSET_T elf_fpregset_t
-
-#ifndef HAVE_ELF_FPREGSET_T
-/* Make sure we have said types.  Not all platforms bring in <linux/elf.h>
-   via <sys/procfs.h>.  */
-#ifdef HAVE_LINUX_ELF_H   
-#include <linux/elf.h>    
-#endif
-#endif
-   
-#include "../gdb_proc_service.h"
-
-#include <sys/ptrace.h>
-
 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
 #endif
 
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-
 /* This module only supports access to the general purpose registers.  */
 
 #define i386_num_regs 16
@@ -63,22 +43,6 @@
   DS * 4, ES * 4, FS * 4, GS * 4
 };
 
-/* Called by libthread_db.  */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph, 
-		    lwpid_t lwpid, int idx, void **base)
-{
-  unsigned int desc[4];
-
-  if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
-	      (void *) idx, (unsigned long) &desc) < 0)
-    return PS_ERR;
-
-  *(int *)base = desc[1];
-  return PS_OK;
-}
-
 static int
 i386_cannot_store_register (int regno)
 {
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 9c41fbb..5733180 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -35,7 +35,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/syscall.h>
 
 /* ``all_threads'' is keyed by the LWP ID - it should be the thread ID instead,
    however.  This requires changing the ID in place when we go from !using_threads
@@ -224,13 +223,6 @@
   struct process_info *process = get_thread_process (thread);
   int wstat;
 
-  /* We avoid killing the first thread here, because of a Linux kernel (at
-     least 2.6.0-test7 through 2.6.8-rc4) bug; if we kill the parent before
-     the children get a chance to be reaped, it will remain a zombie
-     forever.  */
-  if (entry == all_threads.head)
-    return;
-
   do
     {
       ptrace (PTRACE_KILL, pid_of (process), 0, 0);
@@ -243,21 +235,7 @@
 static void
 linux_kill (void)
 {
-  struct thread_info *thread = (struct thread_info *) all_threads.head;
-  struct process_info *process = get_thread_process (thread);
-  int wstat;
-
   for_each_inferior (&all_threads, linux_kill_one_process);
-
-  /* See the comment in linux_kill_one_process.  We did not kill the first
-     thread in the list, so do so now.  */
-  do
-    {
-      ptrace (PTRACE_KILL, pid_of (process), 0, 0);
-
-      /* Make sure it died.  The loop is most likely unnecessary.  */
-      wstat = linux_wait_for_event (thread);
-    } while (WIFSTOPPED (wstat));
 }
 
 static void
@@ -731,30 +709,6 @@
   return ((unsigned char) WSTOPSIG (w));
 }
 
-/* Send a signal to an LWP.  For LinuxThreads, kill is enough; however, if
-   thread groups are in use, we need to use tkill.  */
-
-static int
-kill_lwp (int lwpid, int signo)
-{
-  static int tkill_failed;
-
-  errno = 0;
-
-#ifdef SYS_tkill
-  if (!tkill_failed)
-    {
-      int ret = syscall (SYS_tkill, lwpid, signo);
-      if (errno != ENOSYS)
-        return ret;
-      errno = 0;
-      tkill_failed = 1;
-    }
-#endif
-
-  return kill (lwpid, signo);
-}
-
 static void
 send_sigstop (struct inferior_list_entry *entry)
 {
@@ -774,7 +728,7 @@
   if (debug_threads)
     fprintf (stderr, "Sending sigstop to process %d\n", process->head.id);
 
-  kill_lwp (process->head.id, SIGSTOP);
+  kill (process->head.id, SIGSTOP);
   process->sigstop_sent = 1;
 }
 
@@ -1434,10 +1388,10 @@
       struct process_info *process;
 
       process = get_thread_process (current_inferior);
-      kill_lwp (process->lwpid, signum);
+      kill (process->lwpid, signum);
     }
   else
-    kill_lwp (signal_pid, signum);
+    kill (signal_pid, signum);
 }
 
 /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET
diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c
index 45f00b0..4ee1ae4 100644
--- a/gdb/gdbserver/linux-x86-64-low.c
+++ b/gdb/gdbserver/linux-x86-64-low.c
@@ -1,6 +1,6 @@
 /* GNU/Linux/x86-64 specific low level interface, for the remote server
    for GDB.
-   Copyright 2002, 2004
+   Copyright 2002
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -24,29 +24,10 @@
 #include "linux-low.h"
 #include "i387-fp.h"
 
-/* Correct for all GNU/Linux targets (for quite some time).  */
-#define GDB_GREGSET_T elf_gregset_t
-#define GDB_FPREGSET_T elf_fpregset_t
-
-#ifndef HAVE_ELF_FPREGSET_T
-/* Make sure we have said types.  Not all platforms bring in <linux/elf.h>
-   via <sys/procfs.h>.  */
-#ifdef HAVE_LINUX_ELF_H   
-#include <linux/elf.h>    
-#endif
-#endif
-   
-#include "../gdb_proc_service.h"
-
 #include <sys/reg.h>
 #include <sys/procfs.h>
 #include <sys/ptrace.h>
 
-/* This definition comes from prctl.h, but some kernels may not have it.  */
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL      30
-#endif
-
 static int x86_64_regmap[] = {
   RAX * 8, RBX * 8, RCX * 8, RDX * 8,
   RSI * 8, RDI * 8, RBP * 8, RSP * 8,
@@ -58,28 +39,6 @@
 
 #define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
 
-/* Called by libthread_db.  */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
-                    lwpid_t lwpid, int idx, void **base)
-{
-  switch (idx)
-    {
-    case FS:
-      if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
-	return PS_OK;
-      break;
-    case GS:
-      if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
-	return PS_OK;
-      break;
-    default:
-      return PS_BADADDR;
-    }
-  return PS_ERR;
-}
-
 static void
 x86_64_fill_gregset (void *buf)
 {
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
index 5b83dec..becf565 100644
--- a/gdb/gdbserver/proc-service.c
+++ b/gdb/gdbserver/proc-service.c
@@ -1,5 +1,5 @@
 /* libthread_db helper functions for the remote server for GDB.
-   Copyright 2002, 2004
+   Copyright 2002
    Free Software Foundation, Inc.
 
    Contributed by MontaVista Software.
@@ -48,11 +48,11 @@
 typedef const void *gdb_ps_write_buf_t;
 typedef size_t gdb_ps_size_t;
 
-#ifdef HAVE_LINUX_REGSETS
-#define HAVE_REGSETS
-#endif
-
-#ifdef HAVE_REGSETS
+/* FIXME redo this right */
+#if 0
+#ifndef HAVE_LINUX_REGSETS
+#error HAVE_LINUX_REGSETS required!
+#else
 static struct regset_info *
 gregset_info(void)
 {
@@ -67,6 +67,22 @@
 
   return &target_regsets[i];
 }
+
+static struct regset_info *
+fpregset_info(void)
+{
+  int i = 0;
+
+  while (target_regsets[i].size != -1)
+    {
+      if (target_regsets[i].type == FP_REGS)
+	break;
+      i++;
+    }
+
+  return &target_regsets[i];
+}
+#endif
 #endif
 
 /* Search for the symbol named NAME within the object named OBJ within
@@ -112,8 +128,9 @@
 ps_err_e
 ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
 {
-#ifdef HAVE_REGSETS
+#if 0
   struct thread_info *reg_inferior, *save_inferior;
+  void *regcache;
 
   reg_inferior = (struct thread_info *) find_inferior_id (&all_threads,
 							  lwpid);
@@ -123,14 +140,16 @@
   save_inferior = current_inferior;
   current_inferior = reg_inferior;
 
-  the_target->fetch_registers (0);
-  gregset_info()->fill_function (gregset);
+  regcache = new_register_cache ();
+  the_target->fetch_registers (0, regcache);
+  gregset_info()->fill_function (gregset, regcache);
+  free_register_cache (regcache);
 
   current_inferior = save_inferior;
   return PS_OK;
-#else
-  return PS_ERR;
 #endif
+  /* FIXME */
+  return PS_ERR;
 }
 
 /* Set the general registers of LWP LWPID within the target process PH
@@ -139,7 +158,27 @@
 ps_err_e
 ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
 {
-  /* Unneeded.  */
+#if 0
+  struct thread_info *reg_inferior, *save_inferior;
+  void *regcache;
+
+  reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+  if (reg_inferior == NULL)
+    return PS_ERR;
+
+  save_inferior = current_inferior;
+  current_inferior = reg_inferior;
+
+  regcache = new_register_cache ();
+  gregset_info()->store_function (gregset, regcache);
+  the_target->store_registers (0, regcache);
+  free_register_cache (regcache);
+
+  current_inferior = save_inferior;
+
+  return PS_OK;
+#endif
+  /* FIXME */
   return PS_ERR;
 }
 
@@ -150,7 +189,27 @@
 ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
 	       gdb_prfpregset_t *fpregset)
 {
-  /* Unneeded.  */
+#if 0
+  struct thread_info *reg_inferior, *save_inferior;
+  void *regcache;
+
+  reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+  if (reg_inferior == NULL)
+    return PS_ERR;
+
+  save_inferior = current_inferior;
+  current_inferior = reg_inferior;
+
+  regcache = new_register_cache ();
+  the_target->fetch_registers (0, regcache);
+  fpregset_info()->fill_function (fpregset, regcache);
+  free_register_cache (regcache);
+
+  current_inferior = save_inferior;
+
+  return PS_OK;
+#endif
+  /* FIXME */
   return PS_ERR;
 }
 
@@ -161,7 +220,27 @@
 ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
 	       const gdb_prfpregset_t *fpregset)
 {
-  /* Unneeded.  */
+#if 0
+  struct thread_info *reg_inferior, *save_inferior;
+  void *regcache;
+
+  reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+  if (reg_inferior == NULL)
+    return PS_ERR;
+
+  save_inferior = current_inferior;
+  current_inferior = reg_inferior;
+
+  regcache = new_register_cache ();
+  fpregset_info()->store_function (fpregset, regcache);
+  the_target->store_registers (0, regcache);
+  free_register_cache (regcache);
+
+  current_inferior = save_inferior;
+
+  return PS_OK;
+#endif
+  /* FIXME */
   return PS_ERR;
 }
 
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 0d2bdef..26b267a 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -37,17 +37,6 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 
-/* A cache entry for a successfully looked-up symbol.  */
-struct sym_cache
-{
-  const char *name;
-  CORE_ADDR addr;
-  struct sym_cache *next;
-};
-
-/* The symbol cache.  */
-static struct sym_cache *symbol_cache;
-
 int remote_debug = 0;
 struct ui_file *gdb_stdlog;
 
@@ -364,14 +353,13 @@
   if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0)
     {
       int cc;
-      char c = 0;
+      char c;
       
       cc = read (remote_desc, &c, 1);
 
       if (cc != 1 || c != '\003')
 	{
-	  fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n",
-		   cc, c, c);
+	  fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
 	  return;
 	}
       
@@ -397,33 +385,16 @@
   sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
 }
 
-/* Asynchronous I/O support.  SIGIO must be enabled when waiting, in order to
-   accept Control-C from the client, and must be disabled when talking to
-   the client.  */
-
-/* Current state of asynchronous I/O.  */
-static int async_io_enabled;
-
-/* Enable asynchronous I/O.  */
 void
 enable_async_io (void)
 {
-  if (async_io_enabled)
-    return;
-
   signal (SIGIO, input_interrupt);
-  async_io_enabled = 1;
 }
 
-/* Disable asynchronous I/O.  */
 void
 disable_async_io (void)
 {
-  if (!async_io_enabled)
-    return;
-
   signal (SIGIO, SIG_IGN);
-  async_io_enabled = 0;
 }
 
 /* Returns next char from remote GDB.  -1 if error.  */
@@ -721,23 +692,11 @@
   convert_ascii_to_int (&from[i++], to, *len_ptr);
 }
 
-/* Ask GDB for the address of NAME, and return it in ADDRP if found.
-   Returns 1 if the symbol is found, 0 if it is not, -1 on error.  */
-
 int
 look_up_one_symbol (const char *name, CORE_ADDR *addrp)
 {
   char own_buf[266], *p, *q;
   int len;
-  struct sym_cache *sym;
-
-  /* Check the cache first.  */
-  for (sym = symbol_cache; sym; sym = sym->next)
-    if (strcmp (name, sym->name) == 0)
-      {
-	*addrp = sym->addr;
-	return 1;
-      }
 
   /* Send the request.  */
   strcpy (own_buf, "qSymbol:");
@@ -772,13 +731,6 @@
     return 0;
 
   decode_address (addrp, p, q - p);
-
-  /* Save the symbol in our cache.  */
-  sym = malloc (sizeof (*sym));
-  sym->name = strdup (name);
-  sym->addr = *addrp;
-  sym->next = symbol_cache;
-  symbol_cache = sym;
-
   return 1;
 }
+
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index c6e0c2d..f3d57a5 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -312,36 +312,11 @@
     error ("Cannot find new threads: %s", thread_db_err_str (err));
 }
 
-/* Cache all future symbols that thread_db might request.  We can not
-   request symbols at arbitrary states in the remote protocol, only
-   when the client tells us that new symbols are available.  So when
-   we load the thread library, make sure to check the entire list.  */
-
-static void
-thread_db_look_up_symbols (void)
-{
-  const char **sym_list = td_symbol_list ();
-  CORE_ADDR unused;
-
-  for (sym_list = td_symbol_list (); *sym_list; sym_list++)
-    look_up_one_symbol (*sym_list, &unused);
-}
-
 int
 thread_db_init ()
 {
   int err;
 
-  /* FIXME drow/2004-10-16: This is the "overall process ID", which
-     GNU/Linux calls tgid, "thread group ID".  When we support
-     attaching to threads, the original thread may not be the correct
-     thread.  We would have to get the process ID from /proc for NPTL.
-     For LinuxThreads we could do something similar: follow the chain
-     of parent processes until we find the highest one we're attached
-     to, and use its tgid.
-
-     This isn't the only place in gdbserver that assumes that the first
-     process in the list is the thread group leader.  */
   proc_handle.pid = ((struct inferior_list_entry *)current_inferior)->id;
 
   err = td_ta_new (&proc_handle, &thread_agent);
@@ -357,7 +332,6 @@
       if (thread_db_enable_reporting () == 0)
 	return 0;
       thread_db_find_new_threads ();
-      thread_db_look_up_symbols ();
       return 1;
 
     default:
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index eb28de2..4f95e13 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -293,17 +293,6 @@
 #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
 				   & TYPE_FLAG_ADDRESS_CLASS_ALL)
 
-/* The debugging formats (especially STABS) do not contain enough information
-   to represent all Ada types---especially those whose size depends on
-   dynamic quantities.  Therefore, the GNAT Ada compiler includes
-   extra information in the form of additional type definitions
-   connected by naming conventions.  This flag indicates that the 
-   type is an ordinary (unencoded) GDB type that has been created from 
-   the necessary run-time information, and does not need further 
-   interpretation. Optionally marks ordinary, fixed-size GDB type. */
-
-#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
-
 /*  Array bound type.  */
 enum array_bound_type
 {
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c10e6e6..f43d1ba 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2597,7 +2597,7 @@
   gnu_ops.to_fetch_registers = gnu_fetch_registers;    /* to_fetch_registers */
   gnu_ops.to_store_registers = gnu_store_registers;    /* to_store_registers */
   gnu_ops.to_prepare_to_store = gnu_prepare_to_store; /* to_prepare_to_store */
-  gnu_ops.deprecated_xfer_memory = gnu_xfer_memory;
+  gnu_ops.to_xfer_memory = gnu_xfer_memory; /* to_xfer_memory */
   gnu_ops.to_find_memory_regions = gnu_find_memory_regions;
   gnu_ops.to_insert_breakpoint = memory_insert_breakpoint;
   gnu_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index c34db89..ec3b5aa 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -861,7 +861,7 @@
   go32_ops.to_fetch_registers = go32_fetch_registers;
   go32_ops.to_store_registers = go32_store_registers;
   go32_ops.to_prepare_to_store = go32_prepare_to_store;
-  go32_ops.deprecated_xfer_memory = go32_xfer_memory;
+  go32_ops.to_xfer_memory = go32_xfer_memory;
   go32_ops.to_files_info = go32_files_info;
   go32_ops.to_insert_breakpoint = memory_insert_breakpoint;
   go32_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index db15a1b..1209584 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1660,11 +1660,6 @@
 	    looking_for_rp = 0;
 	    cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
 	  }
-	else if (inst == 0x6bc23fd1) /* stw rp,-0x18(sr0,sp) */
-	  {
-	    looking_for_rp = 0;
-	    cache->saved_regs[HPPA_RP_REGNUM].addr = -24;
-	  }
 	else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
 	  {
 	    looking_for_rp = 0;
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 3979ece..60e2889 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -1,7 +1,7 @@
-/* Native support code for HPUX PA-RISC, for GDB the GNU debugger.
-
-   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+/* Native support code for HPUX PA-RISC.
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -289,10 +289,10 @@
    to debugger memory starting at MYADDR.   Copy to inferior if
    WRITE is nonzero.
 
-   Returns the length copied, which is either the LEN argument or
-   zero.  This xfer function does not do partial moves, since
-   deprecated_child_ops doesn't allow memory operations to cross below
-   us in the target stack anyway.  TARGET is ignored.  */
+   Returns the length copied, which is either the LEN argument or zero.
+   This xfer function does not do partial moves, since child_ops
+   doesn't allow memory operations to cross below us in the target stack
+   anyway.  TARGET is ignored.  */
 
 int
 child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index e9f6cfb..5664314 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -1,8 +1,5 @@
-/* Low level interface for debugging HPUX/DCE threads for GDB, the GNU
-   debugger.
-
-   Copyright 1996, 1998, 1999, 2000, 2001, 2004 Free Software
-   Foundation, Inc.
+/* Low level interface for debugging HPUX/DCE threads for GDB, the GNU debugger.
+   Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -48,6 +45,7 @@
 #include "gdbcore.h"
 
 extern int child_suppress_run;
+extern struct target_ops child_ops;	/* target vector for inftarg.c */
 
 extern void _initialize_hpux_thread (void);
 
@@ -136,7 +134,7 @@
 static void
 hpux_thread_open (char *arg, int from_tty)
 {
-  deprecated_child_ops.to_open (arg, from_tty);
+  child_ops.to_open (arg, from_tty);
 }
 
 /* Attach to process PID, then initialize for debugging it
@@ -145,7 +143,7 @@
 static void
 hpux_thread_attach (char *args, int from_tty)
 {
-  deprecated_child_ops.to_attach (args, from_tty);
+  child_ops.to_attach (args, from_tty);
 
   /* XXX - might want to iterate over all the threads and register them. */
 }
@@ -161,7 +159,7 @@
 static void
 hpux_thread_detach (char *args, int from_tty)
 {
-  deprecated_child_ops.to_detach (args, from_tty);
+  child_ops.to_detach (args, from_tty);
 }
 
 /* Resume execution of process PID.  If STEP is nozero, then
@@ -188,7 +186,7 @@
     }
 #endif
 
-  deprecated_child_ops.to_resume (ptid, step, signo);
+  child_ops.to_resume (ptid, step, signo);
 
   cached_thread = 0;
 
@@ -211,7 +209,7 @@
   if (!ptid_equal (ptid, minus_one_ptid))
     ptid = main_ptid;
 
-  rtnval = deprecated_child_ops.to_wait (ptid, ourstatus);
+  rtnval = child_ops.to_wait (ptid, ourstatus);
 
   rtnval = find_active_thread ();
 
@@ -262,7 +260,7 @@
 
   if (tcb_ptr->state == cma__c_state_running)
     {
-      deprecated_child_ops.to_fetch_registers (regno);
+      child_ops.to_fetch_registers (regno);
 
       do_cleanups (old_chain);
 
@@ -283,7 +281,7 @@
   for (regno = first_regno; regno <= last_regno; regno++)
     {
       if (regmap[regno] == -1)
-	deprecated_child_ops.to_fetch_registers (regno);
+	child_ops.to_fetch_registers (regno);
       else
 	{
 	  unsigned char buf[MAX_REGISTER_SIZE];
@@ -324,7 +322,7 @@
 
   if (tcb_ptr->state == cma__c_state_running)
     {
-      deprecated_child_ops.to_store_registers (regno);
+      child_ops.to_store_registers (regno);
 
       do_cleanups (old_chain);
 
@@ -345,7 +343,7 @@
   for (regno = first_regno; regno <= last_regno; regno++)
     {
       if (regmap[regno] == -1)
-	deprecated_child_ops.to_store_registers (regno);
+	child_ops.to_store_registers (regno);
       else
 	{
 	  unsigned char buf[MAX_REGISTER_SIZE];
@@ -354,7 +352,7 @@
 	  sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
 
 	  if (regno == FLAGS_REGNUM)
-	    deprecated_child_ops.to_store_registers (regno);	/* Let lower layer handle this... */
+	    child_ops.to_store_registers (regno);	/* Let lower layer handle this... */
 	  else if (regno == SP_REGNUM)
 	    {
 	      write_memory ((CORE_ADDR) & tcb_ptr->static_ctx.sp,
@@ -387,7 +385,7 @@
 static void
 hpux_thread_prepare_to_store (void)
 {
-  deprecated_child_ops.to_prepare_to_store ();
+  child_ops.to_prepare_to_store ();
 }
 
 static int
@@ -403,7 +401,7 @@
   inferior_ptid = main_ptid;
 
   retval = 
-    deprecated_child_ops.deprecated_xfer_memory (memaddr, myaddr, len, dowrite, attribs, target);
+    child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, attribs, target);
 
   do_cleanups (old_chain);
 
@@ -415,19 +413,19 @@
 static void
 hpux_thread_files_info (struct target_ops *ignore)
 {
-  deprecated_child_ops.to_files_info (ignore);
+  child_ops.to_files_info (ignore);
 }
 
 static void
 hpux_thread_kill_inferior (void)
 {
-  deprecated_child_ops.to_kill ();
+  child_ops.to_kill ();
 }
 
 static void
 hpux_thread_notice_signals (ptid_t ptid)
 {
-  deprecated_child_ops.to_notice_signals (ptid);
+  child_ops.to_notice_signals (ptid);
 }
 
 /* Fork an inferior process, and start debugging it with /proc.  */
@@ -436,7 +434,7 @@
 hpux_thread_create_inferior (char *exec_file, char *allargs, char **env,
 			     int from_tty)
 {
-  deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+  child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
 
   if (hpux_thread_active)
     {
@@ -500,7 +498,7 @@
 static void
 hpux_thread_mourn_inferior (void)
 {
-  deprecated_child_ops.to_mourn_inferior ();
+  child_ops.to_mourn_inferior ();
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
@@ -520,7 +518,7 @@
 static void
 hpux_thread_stop (void)
 {
-  deprecated_child_ops.to_stop ();
+  child_ops.to_stop ();
 }
 
 /* Convert a pid to printable form. */
@@ -550,7 +548,7 @@
   hpux_thread_ops.to_fetch_registers = hpux_thread_fetch_registers;
   hpux_thread_ops.to_store_registers = hpux_thread_store_registers;
   hpux_thread_ops.to_prepare_to_store = hpux_thread_prepare_to_store;
-  hpux_thread_ops.deprecated_xfer_memory = hpux_thread_xfer_memory;
+  hpux_thread_ops.to_xfer_memory = hpux_thread_xfer_memory;
   hpux_thread_ops.to_files_info = hpux_thread_files_info;
   hpux_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
   hpux_thread_ops.to_remove_breakpoint = memory_remove_breakpoint;
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 6b5f49b..95b4609 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -564,16 +564,14 @@
   return nregs <= DR_NADDR ? 1 : 0;
 }
 
-/* If the inferior has some watchpoint that triggered, set the
-   address associated with that watchpoint and return non-zero.  
-   Otherwise, return zero.  */
+/* If the inferior has some watchpoint that triggered, return the
+   address associated with that watchpoint.  Otherwise, return zero.  */
 
-int
-i386_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+i386_stopped_data_address (void)
 {
   CORE_ADDR addr = 0;
   int i;
-  int rc = 0;
 
   dr_status_mirror = I386_DR_LOW_GET_STATUS ();
 
@@ -588,7 +586,6 @@
 	  && I386_DR_GET_RW_LEN (i) != 0)
 	{
 	  addr = dr_mirror[i];
-	  rc = 1;
 	  if (maint_show_dr)
 	    i386_show_dr ("watchpoint_hit", addr, -1, hw_write);
 	}
@@ -596,16 +593,7 @@
   if (maint_show_dr && addr == 0)
     i386_show_dr ("stopped_data_addr", 0, 0, hw_write);
 
-  if (rc)
-    *addr_p = addr;
-  return rc;
-}
-
-int
-i386_stopped_by_watchpoint (void)
-{
-  CORE_ADDR addr = 0;
-  return i386_stopped_data_address (&addr);
+  return addr;
 }
 
 /* Return non-zero if the inferior has some break/watchpoint that
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index bf4bd94..ca3b95d 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -131,9 +131,6 @@
   t->to_make_corefile_notes = fbsd_make_corefile_notes;
   add_target (t);
 
-  /* Support debugging kernel virtual memory images.  */
-  bsd_kvm_add_target (i386fbsd_supply_pcb);
-
   /* FreeBSD provides a kern.ps_strings sysctl that we can use to
      locate the sigtramp.  That way we can still recognize a sigtramp
      if its location is changed in a new kernel.  Of course this is
@@ -156,4 +153,7 @@
       }
   }
 #endif
+
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (i386fbsd_supply_pcb);
 }
diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
index 023fbb7..f694eba 100644
--- a/gdb/i386gnu-nat.c
+++ b/gdb/i386gnu-nat.c
@@ -28,7 +28,6 @@
 #include "gdb_assert.h"
 #include <errno.h>
 #include <stdio.h>
-#include "gdb_string.h"
 
 #include <mach.h>
 #include <mach_error.h>
@@ -61,9 +60,8 @@
 #define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
 
 
-/* Get the whole floating-point state of THREAD and record the values
-   of the corresponding (pseudo) registers.  */
-
+/* Get the whole floating-point state of THREAD and record the
+   values of the corresponding (pseudo) registers.  */
 static void
 fetch_fpregs (struct proc *thread)
 {
@@ -81,15 +79,18 @@
     }
 
   if (!state.initialized)
+    /* The floating-point state isn't initialized.  */
     {
-      /* The floating-point state isn't initialized.  */
-      i387_supply_fsave (current_regcache, -1, NULL);
+      int i;
+
+      for (i = FP0_REGNUM; i <= FOP_REGNUM; i++)
+	regcache_raw_supply (current_regcache, i, NULL);
+
+      return;
     }
-  else
-    {
-      /* Supply the floating-point registers.  */
-      i387_supply_fsave (current_regcache, -1, state.hw_state);
-    }
+
+  /* Supply the floating-point registers.  */
+  i387_supply_fsave (current_regcache, -1, state.hw_state);
 }
 
 #ifdef HAVE_SYS_PROCFS_H
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 285567c..09daf24 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -418,7 +418,8 @@
 
 #define COPY_REG(_idx_,_regi_) \
   if ((regno == -1) || regno == _regi_) \
-    regcache_raw_collect (current_regcache, _regi_, regp + _idx_)
+    memcpy (regp + _idx_, &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \
+	    register_size (current_gdbarch, _regi_))
 
   for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
     {
@@ -475,12 +476,17 @@
 fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
+  char *to;
+  char *from;
 
   for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
     {
       if ((regno == -1) || (regno == regi))
-	regcache_raw_collect (current_regcache, regi,
-			      &((*fpregsetp)[regi - IA64_FR0_REGNUM]));
+	{
+	  from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)];
+	  to = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
+	  memcpy (to, from, register_size (current_gdbarch, regi));
+	}
     }
 }
 
@@ -630,13 +636,12 @@
   return -1;
 }
 
-int
-ia64_linux_stopped_data_address (CORE_ADDR *addr_p)
+CORE_ADDR
+ia64_linux_stopped_by_watchpoint (ptid_t ptid)
 {
   CORE_ADDR psr;
   int tid;
   struct siginfo siginfo;
-  ptid_t ptid = inferior_ptid;
 
   tid = TIDGET(ptid);
   if (tid == 0)
@@ -654,15 +659,7 @@
                            for the next instruction */
   write_register_pid (IA64_PSR_REGNUM, psr, ptid);
 
-  *addr_p = (CORE_ADDR)siginfo.si_addr;
-  return 1;
-}
-
-int
-ia64_linux_stopped_by_watchpoint (void)
-{
-  CORE_ADDR addr;
-  return ia64_linux_stopped_data_address (&addr);
+  return (CORE_ADDR) siginfo.si_addr;
 }
 
 LONGEST 
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index ebc6c62..cb7b2ec 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -52,6 +52,13 @@
 {
 }
 
+void
+inf_child_post_wait (ptid_t ptid, int wait_status)
+{
+  /* This version of Unix doesn't require a meaningful "post wait"
+     operation.  */
+}
+
 static void
 inf_child_post_attach (int pid)
 {
@@ -190,6 +197,7 @@
   t->to_doc = "Unix child process (started by the \"run\" command).";
   t->to_open = inf_child_open;
   t->to_post_attach = inf_child_post_attach;
+  t->to_post_wait = inf_child_post_wait;
   t->to_fetch_registers = inf_child_fetch_inferior_registers;
   t->to_store_registers = inf_child_store_inferior_registers;
   t->to_prepare_to_store = inf_child_prepare_to_store;
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 283a22d..9e07706 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -32,7 +32,7 @@
 #include "gdbcmd.h"
 #include "gdb_string.h"
 
-#include "gdb_wait.h"
+#include <sys/wait.h>
 #include <signal.h>
 
 /* HACK: Save the ptrace ops returned by ptrace_target.  */
@@ -55,8 +55,8 @@
 
      The kill call causes problems under hpux10, so it's been removed;
      if this causes problems we'll deal with them as they arise.  */
-  ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  wait (&status);
+  call_ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
+  ptrace_wait (null_ptid, &status);
   target_mourn_inferior ();
 }
 
@@ -95,6 +95,145 @@
     perror_with_name ("ptrace");
 }
 
+/* Set an upper limit on alloca.  */
+#define GDB_MAX_ALLOCA 0x1000
+
+/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
+   in the NEW_SUN_PTRACE case.  It ought to be straightforward.  But
+   it appears that writing did not write the data that I specified.  I
+   cannot understand where it got the data that it actually did
+   write.  */
+
+/* Copy LEN bytes to or from inferior's memory starting at MEMADDR to
+   debugger memory starting at MYADDR.  Copy to inferior if WRITE is
+   nonzero.  TARGET is ignored.
+
+   Returns the length copied, which is either the LEN argument or
+   zero.  This xfer function does not do partial moves, since
+   ptrace_ops_hack doesn't allow memory operations to cross below us in the
+   target stack anyway.  */
+
+int
+inf_ptrace_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+			struct mem_attrib *attrib, struct target_ops *target)
+{
+  int i;
+  /* Round starting address down to longword boundary.  */
+  CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET);
+  /* Round ending address up; get number of longwords that makes.  */
+  int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
+	       / sizeof (PTRACE_TYPE_RET));
+  int alloc = count * sizeof (PTRACE_TYPE_RET);
+  PTRACE_TYPE_RET *buffer;
+  struct cleanup *old_chain = NULL;
+
+#ifdef PT_IO
+  /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO request
+     that promises to be much more efficient in reading and writing
+     data in the traced process's address space.  */
+
+  {
+    struct ptrace_io_desc piod;
+
+    /* NOTE: We assume that there are no distinct address spaces for
+       instruction and data.  */
+    piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D;
+    piod.piod_offs = (void *) memaddr;
+    piod.piod_addr = myaddr;
+    piod.piod_len = len;
+
+    if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) & piod, 0) == -1)
+      {
+	/* If the PT_IO request is somehow not supported, fallback on
+	   using PT_WRITE_D/PT_READ_D.  Otherwise we will return zero
+	   to indicate failure.  */
+	if (errno != EINVAL)
+	  return 0;
+      }
+    else
+      {
+	/* Return the actual number of bytes read or written.  */
+	return piod.piod_len;
+      }
+  }
+#endif
+
+  /* Allocate buffer of that many longwords.  */
+  if (len < GDB_MAX_ALLOCA)
+    {
+      buffer = (PTRACE_TYPE_RET *) alloca (alloc);
+    }
+  else
+    {
+      buffer = (PTRACE_TYPE_RET *) xmalloc (alloc);
+      old_chain = make_cleanup (xfree, buffer);
+    }
+
+  if (write)
+    {
+      /* Fill start and end extra bytes of buffer with existing memory
+         data.  */
+      if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET))
+	{
+	  /* Need part of initial word -- fetch it.  */
+	  buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+			      (PTRACE_TYPE_ARG3) addr, 0);
+	}
+
+      if (count > 1)		/* FIXME, avoid if even boundary.  */
+	{
+	  buffer[count - 1] =
+	    ptrace (PT_READ_I, PIDGET (inferior_ptid),
+		    ((PTRACE_TYPE_ARG3)
+		     (addr + (count - 1) * sizeof (PTRACE_TYPE_RET))), 0);
+	}
+
+      /* Copy data to be written over corresponding part of buffer.  */
+      memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
+	      myaddr, len);
+
+      /* Write the entire buffer.  */
+      for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
+	{
+	  errno = 0;
+	  ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
+		  (PTRACE_TYPE_ARG3) addr, buffer[i]);
+	  if (errno)
+	    {
+	      /* Using the appropriate one (I or D) is necessary for
+	         Gould NP1, at least.  */
+	      errno = 0;
+	      ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
+		      (PTRACE_TYPE_ARG3) addr, buffer[i]);
+	    }
+	  if (errno)
+	    return 0;
+	}
+    }
+  else
+    {
+      /* Read all the longwords.  */
+      for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
+	{
+	  errno = 0;
+	  buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+			      (PTRACE_TYPE_ARG3) addr, 0);
+	  if (errno)
+	    return 0;
+	  QUIT;
+	}
+
+      /* Copy appropriate bytes out of the buffer.  */
+      memcpy (myaddr,
+	      (char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
+	      len);
+    }
+
+  if (old_chain != NULL)
+    do_cleanups (old_chain);
+  return len;
+}
+
 /* Wait for child to do something.  Return pid of child, or -1 in case
    of error; store status through argument pointer OURSTATUS.  */
 
@@ -116,7 +255,7 @@
 				   attached process. */
       set_sigio_trap ();
 
-      pid = wait (&status);
+      pid = ptrace_wait (inferior_ptid, &status);
 
       save_errno = errno;
 
@@ -159,6 +298,14 @@
   return pid_to_ptid (pid);
 }
 
+void
+inf_ptrace_post_wait (ptid_t ptid, int wait_status)
+{
+  /* This version of Unix doesn't require a meaningful "post wait"
+     operation.
+   */
+}
+
 /* Check to see if the given thread is alive.
 
    FIXME: Is kill() ever the right way to do this?  I doubt it, but
@@ -188,7 +335,7 @@
   dummy = args;
   pid = strtol (args, &dummy, 0);
   /* Some targets don't set errno on errors, grrr! */
-  if (pid == 0 && args == dummy)
+  if ((pid == 0) && (args == dummy))
     error ("Illegal process-id: %s\n", args);
 
   if (pid == getpid ())		/* Trying to masturbate? */
@@ -208,15 +355,7 @@
       gdb_flush (gdb_stdout);
     }
 
-#ifdef PT_ATTACH
-  errno = 0;
-  ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  if (errno != 0)
-    perror_with_name ("ptrace");
-  attach_flag = 1;
-#else
-  error ("This system does not support attaching to a process");
-#endif
+  attach (pid);
 
   inferior_ptid = pid_to_ptid (pid);
   push_target (ptrace_ops_hack);
@@ -239,7 +378,7 @@
 static void
 inf_ptrace_detach (char *args, int from_tty)
 {
-  int sig = 0;
+  int siggnal = 0;
   int pid = PIDGET (inferior_ptid);
 
   if (from_tty)
@@ -252,17 +391,9 @@
       gdb_flush (gdb_stdout);
     }
   if (args)
-    sig = atoi (args);
+    siggnal = atoi (args);
 
-#ifdef PT_DETACH
-  errno = 0;
-  ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, sig);
-  if (errno != 0)
-    perror_with_name ("ptrace");
-  attach_flag = 0;
-#else
-  error ("This system does not support detaching from a process");
-#endif
+  detach (siggnal);
 
   inferior_ptid = null_ptid;
   unpush_target (ptrace_ops_hack);
@@ -302,7 +433,7 @@
 inf_ptrace_me (void)
 {
   /* "Trace me, Dr. Memory!" */
-  ptrace (0, 0, (PTRACE_TYPE_ARG3) 0, 0);
+  call_ptrace (0, 0, (PTRACE_TYPE_ARG3) 0, 0);
 }
 
 /* Stub function which causes the GDB that runs it, to start ptrace-ing
@@ -480,99 +611,13 @@
   switch (object)
     {
     case TARGET_OBJECT_MEMORY:
-#ifdef PT_IO
-      /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO
-	 request that promises to be much more efficient in reading
-	 and writing data in the traced process's address space.  */
-      {
-	struct ptrace_io_desc piod;
-	
-	/* NOTE: We assume that there are no distinct address spaces
-	   for instruction and data.  */
-	piod.piod_op = writebuf ? PIOD_WRITE_D : PIOD_READ_D;
-	piod.piod_addr = writebuf ? (void *) writebuf : readbuf;
-	piod.piod_offs = (void *) (long) offset;
-	piod.piod_len = len;
-
-	errno = 0;
-	if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) &piod, 0) == 0)
-	  /* Return the actual number of bytes read or written.  */
-	  return piod.piod_len;
-	/* If the PT_IO request is somehow not supported, fallback on
-	   using PT_WRITE_D/PT_READ_D.  Otherwise we will return zero
-	   to indicate failure.  */
-	if (errno != EINVAL)
-	  return 0;
-      }
-#endif
-      {
-	union
-	{
-	  PTRACE_TYPE_RET word;
-	  unsigned char byte[sizeof (PTRACE_TYPE_RET)];
-	} buffer;
-	ULONGEST rounded_offset;
-	LONGEST partial_len;
-	
-	/* Round the start offset down to the next long word
-	   boundary.  */
-	rounded_offset = offset & -(ULONGEST) sizeof (PTRACE_TYPE_RET);
-	
-	/* Since ptrace will transfer a single word starting at that
-	   rounded_offset the partial_len needs to be adjusted down to
-	   that (remember this function only does a single transfer).
-	   Should the required length be even less, adjust it down
-	   again.  */
-	partial_len = (rounded_offset + sizeof (PTRACE_TYPE_RET)) - offset;
-	if (partial_len > len)
-	  partial_len = len;
-	
-	if (writebuf)
-	  {
-	    /* If OFFSET:PARTIAL_LEN is smaller than
-	       ROUNDED_OFFSET:WORDSIZE then a read/modify write will
-	       be needed.  Read in the entire word.  */
-	    if (rounded_offset < offset
-		|| (offset + partial_len
-		    < rounded_offset + sizeof (PTRACE_TYPE_RET)))
-	      /* Need part of initial word -- fetch it.  */
-	      buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
-				    (PTRACE_TYPE_ARG3) (long) rounded_offset,
-				    0);
-	    
-	    /* Copy data to be written over corresponding part of
-	       buffer.  */
-	    memcpy (buffer.byte + (offset - rounded_offset), writebuf, partial_len);
-	    
-	    errno = 0;
-	    ptrace (PT_WRITE_D, PIDGET (inferior_ptid),
-		    (PTRACE_TYPE_ARG3) (long) rounded_offset,
-		    buffer.word);
-	    if (errno)
-	      {
-		/* Using the appropriate one (I or D) is necessary for
-		   Gould NP1, at least.  */
-		errno = 0;
-		ptrace (PT_WRITE_I, PIDGET (inferior_ptid),
-			(PTRACE_TYPE_ARG3) (long) rounded_offset,
-			buffer.word);
-		if (errno)
-		  return 0;
-	      }
-	  }
-	if (readbuf)
-	  {
-	    errno = 0;
-	    buffer.word = ptrace (PT_READ_I, PIDGET (inferior_ptid),
-				  (PTRACE_TYPE_ARG3) (long) rounded_offset, 0);
-	    if (errno)
-	      return 0;
-	    /* Copy appropriate bytes out of the buffer.  */
-	    memcpy (readbuf, buffer.byte + (offset - rounded_offset),
-		    partial_len);
-	  }
-	return partial_len;
-      }
+      if (readbuf)
+	return inf_ptrace_xfer_memory (offset, readbuf, len, 0 /*write */ ,
+				       NULL, ops);
+      if (writebuf)
+	return inf_ptrace_xfer_memory (offset, readbuf, len, 1 /*write */ ,
+				       NULL, ops);
+      return -1;
 
     case TARGET_OBJECT_UNWIND_TABLE:
       return -1;
@@ -604,7 +649,9 @@
   t->to_detach = inf_ptrace_detach;
   t->to_resume = inf_ptrace_resume;
   t->to_wait = inf_ptrace_wait;
+  t->to_post_wait = inf_ptrace_post_wait;
   t->to_prepare_to_store = inf_ptrace_prepare_to_store;
+  t->to_xfer_memory = inf_ptrace_xfer_memory;
   t->to_xfer_partial = inf_ptrace_xfer_partial;
   t->to_files_info = inf_ptrace_files_info;
   t->to_kill = inf_ptrace_kill_inferior;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index ec4f11a..53bcffd 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -307,7 +307,7 @@
   CORE_ADDR funaddr;
   int using_gcc;		/* Set to version of gcc in use, or zero if not gcc */
   CORE_ADDR real_pc;
-  struct type *ftype = check_typedef (VALUE_TYPE (function));
+  struct type *ftype = check_typedef (SYMBOL_TYPE (function));
   CORE_ADDR bp_addr;
   struct regcache *caller_regcache;
   struct cleanup *caller_regcache_cleanup;
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index ec4ad16..a9abbf2 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -138,16 +138,13 @@
 /* Wait for a process to finish, possibly running a target-specific
    hook before returning.  */
 
-/* NOTE: cagney: 2004-09-29: Dependant on the native configuration,
-   "hppah-nat.c" may either call this or infttrace.c's implementation
-   of ptrace_wait.  See "hppahpux.mh".  */
-
 int
 ptrace_wait (ptid_t ptid, int *status)
 {
   int wstate;
 
   wstate = wait (status);
+  target_post_wait (pid_to_ptid (wstate), *status);
   return wstate;
 }
 
@@ -174,7 +171,7 @@
      The kill call causes problems under hpux10, so it's been removed;
      if this causes problems we'll deal with them as they arise.  */
   ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  wait (&status);
+  ptrace_wait (null_ptid, &status);
   target_mourn_inferior ();
 }
 #endif /* DEPRECATED_KILL_INFERIOR */
@@ -403,8 +400,8 @@
 
    Returns the length copied, which is either the LEN argument or
    zero.  This xfer function does not do partial moves, since
-   deprecated_child_ops doesn't allow memory operations to cross below
-   us in the target stack anyway.  */
+   child_ops doesn't allow memory operations to cross below us in the
+   target stack anyway.  */
 
 int
 child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7cf9953..cc302c2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -935,9 +935,9 @@
 void handle_inferior_event (struct execution_control_state *ecs);
 
 static void step_into_function (struct execution_control_state *ecs);
-static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame);
-static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
-						  struct frame_id sr_id);
+static void insert_step_resume_breakpoint (struct frame_info *step_frame,
+					   struct execution_control_state
+					   *ecs);
 static void stop_stepping (struct execution_control_state *ecs);
 static void prepare_to_wait (struct execution_control_state *ecs);
 static void keep_going (struct execution_control_state *ecs);
@@ -1081,6 +1081,18 @@
   ecs->wp = &(ecs->ws);
 }
 
+/* Call this function before setting step_resume_breakpoint, as a
+   sanity check.  There should never be more than one step-resume
+   breakpoint per thread, so we should never be setting a new
+   step_resume_breakpoint when one is already active.  */
+static void
+check_for_old_step_resume_breakpoint (void)
+{
+  if (step_resume_breakpoint)
+    warning
+      ("GDB bug: infrun.c (wait_for_inferior): dropping old step_resume breakpoint");
+}
+
 /* Return the cached copy of the last pid/waitstatus returned by
    target_wait()/deprecated_target_wait_hook().  The data is actually
    cached by handle_inferior_event(), which gets called immediately
@@ -1935,7 +1947,7 @@
 	     code paths as single-step - set a breakpoint at the
 	     signal return address and then, once hit, step off that
 	     breakpoint.  */
-	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
+	  insert_step_resume_breakpoint (get_current_frame (), ecs);
 	  ecs->step_after_step_resume_breakpoint = 1;
 	}
       else if (step_range_end != 0
@@ -1953,7 +1965,7 @@
 	     Note that this is only needed for a signal delivered
 	     while in the single-step range.  Nested signals aren't a
 	     problem as they eventually all return.  */
-	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
+	  insert_step_resume_breakpoint (get_current_frame (), ecs);
 	}
       keep_going (ecs);
       return;
@@ -2261,7 +2273,11 @@
 	  init_sal (&sr_sal);
 	  sr_sal.pc = pc_after_resolver;
 
-	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	  check_for_old_step_resume_breakpoint ();
+	  step_resume_breakpoint =
+	    set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+	  if (breakpoints_inserted)
+	    insert_breakpoints ();
 	}
 
       keep_going (ecs);
@@ -2319,7 +2335,8 @@
 	  /* We're doing a "next", set a breakpoint at callee's return
 	     address (the address at which the caller will
 	     resume).  */
-	  insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+	  insert_step_resume_breakpoint (get_prev_frame
+					 (get_current_frame ()), ecs);
 	  keep_going (ecs);
 	  return;
 	}
@@ -2329,7 +2346,8 @@
 	  /* We're doing a "next", set a breakpoint at callee's return
 	     address (the address at which the caller will
 	     resume).  */
-	  insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+	  insert_step_resume_breakpoint (get_prev_frame
+					 (get_current_frame ()), ecs);
 	  keep_going (ecs);
 	  return;
 	}
@@ -2351,7 +2369,12 @@
 	  init_sal (&sr_sal);
 	  sr_sal.pc = ecs->stop_func_start;
 
-	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	  check_for_old_step_resume_breakpoint ();
+	  step_resume_breakpoint =
+	    set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+	  if (breakpoints_inserted)
+	    insert_breakpoints ();
+
 	  keep_going (ecs);
 	  return;
 	}
@@ -2386,7 +2409,8 @@
 
       /* Set a breakpoint at callee's return address (the address at
          which the caller will resume).  */
-      insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+      insert_step_resume_breakpoint (get_prev_frame (get_current_frame ()),
+				     ecs);
       keep_going (ecs);
       return;
     }
@@ -2407,11 +2431,14 @@
 	  init_sal (&sr_sal);	/* initialize to zeroes */
 	  sr_sal.pc = real_stop_pc;
 	  sr_sal.section = find_pc_overlay (sr_sal.pc);
-
-	  /* Do not specify what the fp should be when we stop since
-	     on some machines the prologue is where the new fp value
-	     is established.  */
-	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+	  /* Do not specify what the fp should be when we stop
+	     since on some machines the prologue
+	     is where the new fp value is established.  */
+	  check_for_old_step_resume_breakpoint ();
+	  step_resume_breakpoint =
+	    set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+	  if (breakpoints_inserted)
+	    insert_breakpoints ();
 
 	  /* Restart without fiddling with the step ranges or
 	     other state.  */
@@ -2446,7 +2473,8 @@
 	{
 	  /* Set a breakpoint at callee's return address (the address
 	     at which the caller will resume).  */
-	  insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+	  insert_step_resume_breakpoint (get_prev_frame
+					 (get_current_frame ()), ecs);
 	  keep_going (ecs);
 	  return;
 	}
@@ -2617,11 +2645,14 @@
       init_sal (&sr_sal);	/* initialize to zeroes */
       sr_sal.pc = ecs->stop_func_start;
       sr_sal.section = find_pc_overlay (ecs->stop_func_start);
-
       /* Do not specify what the fp should be when we stop since on
          some machines the prologue is where the new fp value is
          established.  */
-      insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+      check_for_old_step_resume_breakpoint ();
+      step_resume_breakpoint =
+	set_momentary_breakpoint (sr_sal, null_frame_id, bp_step_resume);
+      if (breakpoints_inserted)
+	insert_breakpoints ();
 
       /* And make sure stepping stops right away then.  */
       step_range_end = step_range_start;
@@ -2629,23 +2660,6 @@
   keep_going (ecs);
 }
 
-/* Insert a "step resume breakpoint" at SR_SAL with frame ID SR_ID.
-   This is used to both functions and to skip over code.  */
-
-static void
-insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
-				      struct frame_id sr_id)
-{
-  /* There should never be more than one step-resume breakpoint per
-     thread, so we should never be setting a new
-     step_resume_breakpoint when one is already active.  */
-  gdb_assert (step_resume_breakpoint == NULL);
-  step_resume_breakpoint = set_momentary_breakpoint (sr_sal, sr_id,
-						     bp_step_resume);
-  if (breakpoints_inserted)
-    insert_breakpoints ();
-}
-				      
 /* Insert a "step resume breakpoint" at RETURN_FRAME.pc.  This is used
    to skip a function (next, skip-no-debug) or signal.  It's assumed
    that the function/signal handler being skipped eventually returns
@@ -2661,7 +2675,8 @@
    the interrupted function at RETURN_FRAME.pc.  */
 
 static void
-insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame)
+insert_step_resume_breakpoint (struct frame_info *return_frame,
+			       struct execution_control_state *ecs)
 {
   struct symtab_and_line sr_sal;
 
@@ -2670,7 +2685,14 @@
   sr_sal.pc = ADDR_BITS_REMOVE (get_frame_pc (return_frame));
   sr_sal.section = find_pc_overlay (sr_sal.pc);
 
-  insert_step_resume_breakpoint_at_sal (sr_sal, get_frame_id (return_frame));
+  check_for_old_step_resume_breakpoint ();
+
+  step_resume_breakpoint
+    = set_momentary_breakpoint (sr_sal, get_frame_id (return_frame),
+				bp_step_resume);
+
+  if (breakpoints_inserted)
+    insert_breakpoints ();
 }
 
 static void
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index e9ace23..68efdac 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -53,6 +53,10 @@
 static ptid_t child_wait (ptid_t, struct target_waitstatus *);
 #endif /* CHILD_WAIT */
 
+#if !defined(CHILD_POST_WAIT)
+void child_post_wait (ptid_t, int);
+#endif
+
 static void child_open (char *, int);
 
 static void child_files_info (struct target_ops *);
@@ -85,6 +89,8 @@
 
 extern char **environ;
 
+struct target_ops child_ops;
+
 int child_suppress_run = 0;	/* Non-zero if inftarg should pretend not to
 				   be a runnable target.  Used by targets
 				   that can sit atop inftarg, such as HPUX
@@ -113,7 +119,7 @@
 				   attached process. */
       set_sigio_trap ();
 
-      pid = wait (&status);
+      pid = ptrace_wait (inferior_ptid, &status);
 
       save_errno = errno;
 
@@ -155,6 +161,17 @@
 }
 #endif /* CHILD_WAIT */
 
+#if !defined(CHILD_POST_WAIT)
+void
+child_post_wait (ptid_t ptid, int wait_status)
+{
+  /* This version of Unix doesn't require a meaningful "post wait"
+     operation.
+   */
+}
+#endif
+
+
 #ifndef CHILD_THREAD_ALIVE
 
 /* Check to see if the given thread is alive.
@@ -210,7 +227,7 @@
   attach (pid);
   
   inferior_ptid = pid_to_ptid (pid);
-  push_target (&deprecated_child_ops);
+  push_target (&child_ops);
 }
 
 #if !defined(CHILD_POST_ATTACH)
@@ -251,7 +268,7 @@
   detach (siggnal);
   
   inferior_ptid = null_ptid;
-  unpush_target (&deprecated_child_ops);
+  unpush_target (&child_ops);
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -299,7 +316,7 @@
 static void
 ptrace_him (int pid)
 {
-  push_target (&deprecated_child_ops);
+  push_target (&child_ops);
 
   /* On some targets, there must be some explicit synchronization
      between the parent and child processes after the debugger
@@ -462,7 +479,7 @@
 static void
 child_mourn_inferior (void)
 {
-  unpush_target (&deprecated_child_ops);
+  unpush_target (&child_ops);
   generic_mourn_inferior ();
 }
 
@@ -540,7 +557,7 @@
 	return child_xfer_memory (offset, readbuf, len, 0/*write*/,
 				  NULL, ops);
       if (writebuf)
-	return child_xfer_memory (offset, (void *) writebuf, len, 1/*write*/,
+	return child_xfer_memory (offset, readbuf, len, 1/*write*/,
 				  NULL, ops);
       return -1;
 
@@ -581,57 +598,76 @@
 static void
 init_child_ops (void)
 {
-  deprecated_child_ops.to_shortname = "child";
-  deprecated_child_ops.to_longname = "Unix child process";
-  deprecated_child_ops.to_doc = "Unix child process (started by the \"run\" command).";
-  deprecated_child_ops.to_open = child_open;
-  deprecated_child_ops.to_attach = child_attach;
-  deprecated_child_ops.to_post_attach = child_post_attach;
-  deprecated_child_ops.to_detach = child_detach;
-  deprecated_child_ops.to_resume = child_resume;
-  deprecated_child_ops.to_wait = child_wait;
-  deprecated_child_ops.to_fetch_registers = fetch_inferior_registers;
-  deprecated_child_ops.to_store_registers = store_inferior_registers;
-  deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
-  deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
-  deprecated_child_ops.to_xfer_partial = child_xfer_partial;
-  deprecated_child_ops.to_files_info = child_files_info;
-  deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
-  deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
-  deprecated_child_ops.to_terminal_init = terminal_init_inferior;
-  deprecated_child_ops.to_terminal_inferior = terminal_inferior;
-  deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
-  deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
-  deprecated_child_ops.to_terminal_ours = terminal_ours;
-  deprecated_child_ops.to_terminal_info = child_terminal_info;
-  deprecated_child_ops.to_kill = kill_inferior;
-  deprecated_child_ops.to_create_inferior = child_create_inferior;
-  deprecated_child_ops.to_post_startup_inferior = child_post_startup_inferior;
-  deprecated_child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
-  deprecated_child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
-  deprecated_child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
-  deprecated_child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
-  deprecated_child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
-  deprecated_child_ops.to_follow_fork = child_follow_fork;
-  deprecated_child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
-  deprecated_child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
-  deprecated_child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
-  deprecated_child_ops.to_has_exited = child_has_exited;
-  deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
-  deprecated_child_ops.to_can_run = child_can_run;
-  deprecated_child_ops.to_thread_alive = child_thread_alive;
-  deprecated_child_ops.to_pid_to_str = child_pid_to_str;
-  deprecated_child_ops.to_stop = child_stop;
-  deprecated_child_ops.to_enable_exception_callback = child_enable_exception_callback;
-  deprecated_child_ops.to_get_current_exception_event = child_get_current_exception_event;
-  deprecated_child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
-  deprecated_child_ops.to_stratum = process_stratum;
-  deprecated_child_ops.to_has_all_memory = 1;
-  deprecated_child_ops.to_has_memory = 1;
-  deprecated_child_ops.to_has_stack = 1;
-  deprecated_child_ops.to_has_registers = 1;
-  deprecated_child_ops.to_has_execution = 1;
-  deprecated_child_ops.to_magic = OPS_MAGIC;
+  child_ops.to_shortname = "child";
+  child_ops.to_longname = "Unix child process";
+  child_ops.to_doc = "Unix child process (started by the \"run\" command).";
+  child_ops.to_open = child_open;
+  child_ops.to_attach = child_attach;
+  child_ops.to_post_attach = child_post_attach;
+  child_ops.to_detach = child_detach;
+  child_ops.to_resume = child_resume;
+  child_ops.to_wait = child_wait;
+  child_ops.to_post_wait = child_post_wait;
+  child_ops.to_fetch_registers = fetch_inferior_registers;
+  child_ops.to_store_registers = store_inferior_registers;
+  child_ops.to_prepare_to_store = child_prepare_to_store;
+  child_ops.to_xfer_memory = child_xfer_memory;
+  child_ops.to_xfer_partial = child_xfer_partial;
+  child_ops.to_files_info = child_files_info;
+  child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+  child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+  child_ops.to_terminal_init = terminal_init_inferior;
+  child_ops.to_terminal_inferior = terminal_inferior;
+  child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+  child_ops.to_terminal_save_ours = terminal_save_ours;
+  child_ops.to_terminal_ours = terminal_ours;
+  child_ops.to_terminal_info = child_terminal_info;
+  child_ops.to_kill = kill_inferior;
+  child_ops.to_create_inferior = child_create_inferior;
+  child_ops.to_post_startup_inferior = child_post_startup_inferior;
+  child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
+  child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+  child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
+  child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+  child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
+  child_ops.to_follow_fork = child_follow_fork;
+  child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+  child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
+  child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
+  child_ops.to_has_exited = child_has_exited;
+  child_ops.to_mourn_inferior = child_mourn_inferior;
+  child_ops.to_can_run = child_can_run;
+  child_ops.to_thread_alive = child_thread_alive;
+  child_ops.to_pid_to_str = child_pid_to_str;
+  child_ops.to_stop = child_stop;
+  child_ops.to_enable_exception_callback = child_enable_exception_callback;
+  child_ops.to_get_current_exception_event = child_get_current_exception_event;
+  child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
+  child_ops.to_stratum = process_stratum;
+  child_ops.to_has_all_memory = 1;
+  child_ops.to_has_memory = 1;
+  child_ops.to_has_stack = 1;
+  child_ops.to_has_registers = 1;
+  child_ops.to_has_execution = 1;
+  child_ops.to_magic = OPS_MAGIC;
+}
+
+/* Take over the 'find_mapped_memory' vector from inftarg.c. */
+extern void
+inftarg_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR,
+						       unsigned long,
+						       int, int, int,
+						       void *),
+					      void *))
+{
+  child_ops.to_find_memory_regions = func;
+}
+
+/* Take over the 'make_corefile_notes' vector from inftarg.c. */
+extern void
+inftarg_set_make_corefile_notes (char * (*func) (bfd *, int *))
+{
+  child_ops.to_make_corefile_notes = func;
 }
 
 void
@@ -656,5 +692,5 @@
 #endif
 
   init_child_ops ();
-  add_target (&deprecated_child_ops);
+  add_target (&child_ops);
 }
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index 4171651..30e893c 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -2888,6 +2888,9 @@
       *status = _SIGTRAP;
     }
 
+  target_post_wait (pid_to_ptid (tsp.tts_pid), *status);
+
+
 #ifdef THREAD_DEBUG
   if (debug_on)
     printf ("Done waiting, pid is %d, tid %d\n", real_pid, real_tid);
@@ -4815,10 +4818,10 @@
    to debugger memory starting at MYADDR.   Copy to inferior if
    WRITE is nonzero.  TARGET is ignored.
 
-   Returns the length copied, which is either the LEN argument or
-   zero.  This xfer function does not do partial moves, since
-   deprecated_child_ops doesn't allow memory operations to cross below
-   us in the target stack anyway.  */
+   Returns the length copied, which is either the LEN argument or zero.
+   This xfer function does not do partial moves, since child_ops
+   doesn't allow memory operations to cross below us in the target stack
+   anyway.  */
 
 int
 child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
diff --git a/gdb/language.c b/gdb/language.c
index cdf35ea..d705062 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1286,7 +1286,7 @@
   int i;
 
   l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch);
-  for (i = 0; i < languages_size; i++)
+  for (i = 0; i <= languages_size; i++)
     {
       if (languages[i] != NULL
 	  && languages[i]->la_language_arch_info != NULL)
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
new file mode 100644
index 0000000..5971630
--- /dev/null
+++ b/gdb/lin-lwp.c
@@ -0,0 +1,1971 @@
+/* Multi-threaded debugging support for GNU/Linux (LWP layer).
+   Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+
+#include "gdb_assert.h"
+#include "gdb_string.h"
+#include <errno.h>
+#include <signal.h>
+#ifdef HAVE_TKILL_SYSCALL
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
+#include <sys/ptrace.h>
+#include "gdb_wait.h"
+
+#include "gdbthread.h"
+#include "inferior.h"
+#include "target.h"
+#include "regcache.h"
+#include "gdbcmd.h"
+
+static int debug_lin_lwp;
+extern char *strsignal (int sig);
+
+#include "linux-nat.h"
+
+/* On GNU/Linux there are no real LWP's.  The closest thing to LWP's
+   are processes sharing the same VM space.  A multi-threaded process
+   is basically a group of such processes.  However, such a grouping
+   is almost entirely a user-space issue; the kernel doesn't enforce
+   such a grouping at all (this might change in the future).  In
+   general, we'll rely on the threads library (i.e. the GNU/Linux
+   Threads library) to provide such a grouping.
+
+   It is perfectly well possible to write a multi-threaded application
+   without the assistance of a threads library, by using the clone
+   system call directly.  This module should be able to give some
+   rudimentary support for debugging such applications if developers
+   specify the CLONE_PTRACE flag in the clone system call, and are
+   using the Linux kernel 2.4 or above.
+
+   Note that there are some peculiarities in GNU/Linux that affect
+   this code:
+
+   - In general one should specify the __WCLONE flag to waitpid in
+     order to make it report events for any of the cloned processes
+     (and leave it out for the initial process).  However, if a cloned
+     process has exited the exit status is only reported if the
+     __WCLONE flag is absent.  Linux kernel 2.4 has a __WALL flag, but
+     we cannot use it since GDB must work on older systems too.
+
+   - When a traced, cloned process exits and is waited for by the
+     debugger, the kernel reassigns it to the original parent and
+     keeps it around as a "zombie".  Somehow, the GNU/Linux Threads
+     library doesn't notice this, which leads to the "zombie problem":
+     When debugged a multi-threaded process that spawns a lot of
+     threads will run out of processes, even if the threads exit,
+     because the "zombies" stay around.  */
+
+/* List of known LWPs.  */
+static struct lwp_info *lwp_list;
+
+/* Number of LWPs in the list.  */
+static int num_lwps;
+
+/* Non-zero if we're running in "threaded" mode.  */
+static int threaded;
+
+
+#define GET_LWP(ptid)		ptid_get_lwp (ptid)
+#define GET_PID(ptid)		ptid_get_pid (ptid)
+#define is_lwp(ptid)		(GET_LWP (ptid) != 0)
+#define BUILD_LWP(lwp, pid)	ptid_build (pid, lwp, 0)
+
+/* If the last reported event was a SIGTRAP, this variable is set to
+   the process id of the LWP/thread that got it.  */
+ptid_t trap_ptid;
+
+
+/* This module's target-specific operations.  */
+static struct target_ops lin_lwp_ops;
+
+/* The standard child operations.  */
+extern struct target_ops child_ops;
+
+/* Since we cannot wait (in lin_lwp_wait) for the initial process and
+   any cloned processes with a single call to waitpid, we have to use
+   the WNOHANG flag and call waitpid in a loop.  To optimize
+   things a bit we use `sigsuspend' to wake us up when a process has
+   something to report (it will send us a SIGCHLD if it has).  To make
+   this work we have to juggle with the signal mask.  We save the
+   original signal mask such that we can restore it before creating a
+   new process in order to avoid blocking certain signals in the
+   inferior.  We then block SIGCHLD during the waitpid/sigsuspend
+   loop.  */
+
+/* Original signal mask.  */
+static sigset_t normal_mask;
+
+/* Signal mask for use with sigsuspend in lin_lwp_wait, initialized in
+   _initialize_lin_lwp.  */
+static sigset_t suspend_mask;
+
+/* Signals to block to make that sigsuspend work.  */
+static sigset_t blocked_mask;
+
+
+/* Prototypes for local functions.  */
+static int stop_wait_callback (struct lwp_info *lp, void *data);
+static int lin_lwp_thread_alive (ptid_t ptid);
+
+/* Convert wait status STATUS to a string.  Used for printing debug
+   messages only.  */
+
+static char *
+status_to_str (int status)
+{
+  static char buf[64];
+
+  if (WIFSTOPPED (status))
+    snprintf (buf, sizeof (buf), "%s (stopped)",
+	      strsignal (WSTOPSIG (status)));
+  else if (WIFSIGNALED (status))
+    snprintf (buf, sizeof (buf), "%s (terminated)",
+	      strsignal (WSTOPSIG (status)));
+  else
+    snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
+
+  return buf;
+}
+
+/* Initialize the list of LWPs.  Note that this module, contrary to
+   what GDB's generic threads layer does for its thread list,
+   re-initializes the LWP lists whenever we mourn or detach (which
+   doesn't involve mourning) the inferior.  */
+
+static void
+init_lwp_list (void)
+{
+  struct lwp_info *lp, *lpnext;
+
+  for (lp = lwp_list; lp; lp = lpnext)
+    {
+      lpnext = lp->next;
+      xfree (lp);
+    }
+
+  lwp_list = NULL;
+  num_lwps = 0;
+  threaded = 0;
+}
+
+/* Add the LWP specified by PID to the list.  If this causes the
+   number of LWPs to become larger than one, go into "threaded" mode.
+   Return a pointer to the structure describing the new LWP.  */
+
+static struct lwp_info *
+add_lwp (ptid_t ptid)
+{
+  struct lwp_info *lp;
+
+  gdb_assert (is_lwp (ptid));
+
+  lp = (struct lwp_info *) xmalloc (sizeof (struct lwp_info));
+
+  memset (lp, 0, sizeof (struct lwp_info));
+
+  lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+
+  lp->ptid = ptid;
+
+  lp->next = lwp_list;
+  lwp_list = lp;
+  if (++num_lwps > 1)
+    threaded = 1;
+
+  return lp;
+}
+
+/* Remove the LWP specified by PID from the list.  */
+
+static void
+delete_lwp (ptid_t ptid)
+{
+  struct lwp_info *lp, *lpprev;
+
+  lpprev = NULL;
+
+  for (lp = lwp_list; lp; lpprev = lp, lp = lp->next)
+    if (ptid_equal (lp->ptid, ptid))
+      break;
+
+  if (!lp)
+    return;
+
+  /* We don't go back to "non-threaded" mode if the number of threads
+     becomes less than two.  */
+  num_lwps--;
+
+  if (lpprev)
+    lpprev->next = lp->next;
+  else
+    lwp_list = lp->next;
+
+  xfree (lp);
+}
+
+/* Return a pointer to the structure describing the LWP corresponding
+   to PID.  If no corresponding LWP could be found, return NULL.  */
+
+static struct lwp_info *
+find_lwp_pid (ptid_t ptid)
+{
+  struct lwp_info *lp;
+  int lwp;
+
+  if (is_lwp (ptid))
+    lwp = GET_LWP (ptid);
+  else
+    lwp = GET_PID (ptid);
+
+  for (lp = lwp_list; lp; lp = lp->next)
+    if (lwp == GET_LWP (lp->ptid))
+      return lp;
+
+  return NULL;
+}
+
+/* Call CALLBACK with its second argument set to DATA for every LWP in
+   the list.  If CALLBACK returns 1 for a particular LWP, return a
+   pointer to the structure describing that LWP immediately.
+   Otherwise return NULL.  */
+
+struct lwp_info *
+iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
+{
+  struct lwp_info *lp, *lpnext;
+
+  for (lp = lwp_list; lp; lp = lpnext)
+    {
+      lpnext = lp->next;
+      if ((*callback) (lp, data))
+	return lp;
+    }
+
+  return NULL;
+}
+
+
+#if 0
+static void
+lin_lwp_open (char *args, int from_tty)
+{
+  push_target (&lin_lwp_ops);
+}
+#endif
+
+/* Attach to the LWP specified by PID.  If VERBOSE is non-zero, print
+   a message telling the user that a new LWP has been added to the
+   process.  */
+
+void
+lin_lwp_attach_lwp (ptid_t ptid, int verbose)
+{
+  struct lwp_info *lp, *found_lp;
+
+  gdb_assert (is_lwp (ptid));
+
+  /* Make sure SIGCHLD is blocked.  We don't want SIGCHLD events
+     to interrupt either the ptrace() or waitpid() calls below.  */
+  if (!sigismember (&blocked_mask, SIGCHLD))
+    {
+      sigaddset (&blocked_mask, SIGCHLD);
+      sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+    }
+
+  if (verbose)
+    printf_filtered ("[New %s]\n", target_pid_to_str (ptid));
+
+  found_lp = lp = find_lwp_pid (ptid);
+  if (lp == NULL)
+    lp = add_lwp (ptid);
+
+  /* We assume that we're already attached to any LWP that has an id
+     equal to the overall process id, and to any LWP that is already
+     in our list of LWPs.  If we're not seeing exit events from threads
+     and we've had PID wraparound since we last tried to stop all threads,
+     this assumption might be wrong; fortunately, this is very unlikely
+     to happen.  */
+  if (GET_LWP (ptid) != GET_PID (ptid) && found_lp == NULL)
+    {
+      pid_t pid;
+      int status;
+
+      if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
+	error ("Can't attach %s: %s", target_pid_to_str (ptid),
+	       safe_strerror (errno));
+
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
+			    target_pid_to_str (ptid));
+
+      pid = waitpid (GET_LWP (ptid), &status, 0);
+      if (pid == -1 && errno == ECHILD)
+	{
+	  /* Try again with __WCLONE to check cloned processes.  */
+	  pid = waitpid (GET_LWP (ptid), &status, __WCLONE);
+	  lp->cloned = 1;
+	}
+
+      gdb_assert (pid == GET_LWP (ptid)
+		  && WIFSTOPPED (status) && WSTOPSIG (status));
+
+      child_post_attach (pid);
+
+      lp->stopped = 1;
+
+      if (debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "LLAL: waitpid %s received %s\n",
+			      target_pid_to_str (ptid),
+			      status_to_str (status));
+	}
+    }
+  else
+    {
+      /* We assume that the LWP representing the original process
+         is already stopped.  Mark it as stopped in the data structure
+         that the lin-lwp layer uses to keep track of threads.  Note
+         that this won't have already been done since the main thread
+         will have, we assume, been stopped by an attach from a
+         different layer.  */
+      lp->stopped = 1;
+    }
+}
+
+static void
+lin_lwp_attach (char *args, int from_tty)
+{
+  struct lwp_info *lp;
+  pid_t pid;
+  int status;
+
+  /* FIXME: We should probably accept a list of process id's, and
+     attach all of them.  */
+  child_ops.to_attach (args, from_tty);
+
+  /* Add the initial process as the first LWP to the list.  */
+  lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
+
+  /* Make sure the initial process is stopped.  The user-level threads
+     layer might want to poke around in the inferior, and that won't
+     work if things haven't stabilized yet.  */
+  pid = waitpid (GET_PID (inferior_ptid), &status, 0);
+  if (pid == -1 && errno == ECHILD)
+    {
+      warning ("%s is a cloned process", target_pid_to_str (inferior_ptid));
+
+      /* Try again with __WCLONE to check cloned processes.  */
+      pid = waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
+      lp->cloned = 1;
+    }
+
+  gdb_assert (pid == GET_PID (inferior_ptid)
+	      && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
+
+  lp->stopped = 1;
+
+  /* Fake the SIGSTOP that core GDB expects.  */
+  lp->status = W_STOPCODE (SIGSTOP);
+  lp->resumed = 1;
+  if (debug_lin_lwp)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
+    }
+}
+
+static int
+detach_callback (struct lwp_info *lp, void *data)
+{
+  gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
+
+  if (debug_lin_lwp && lp->status)
+    fprintf_unfiltered (gdb_stdlog, "DC:  Pending %s for %s on detach.\n",
+			strsignal (WSTOPSIG (lp->status)),
+			target_pid_to_str (lp->ptid));
+
+  while (lp->signalled && lp->stopped)
+    {
+      errno = 0;
+      if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
+		  WSTOPSIG (lp->status)) < 0)
+	error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
+	       safe_strerror (errno));
+
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "DC:  PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
+			    target_pid_to_str (lp->ptid),
+			    status_to_str (lp->status));
+
+      lp->stopped = 0;
+      lp->signalled = 0;
+      lp->status = 0;
+      /* FIXME drow/2003-08-26: There was a call to stop_wait_callback
+	 here.  But since lp->signalled was cleared above,
+	 stop_wait_callback didn't do anything; the process was left
+	 running.  Shouldn't we be waiting for it to stop?
+	 I've removed the call, since stop_wait_callback now does do
+	 something when called with lp->signalled == 0.  */
+
+      gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
+    }
+
+  /* We don't actually detach from the LWP that has an id equal to the
+     overall process id just yet.  */
+  if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
+    {
+      errno = 0;
+      if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
+		  WSTOPSIG (lp->status)) < 0)
+	error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
+	       safe_strerror (errno));
+
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "PTRACE_DETACH (%s, %s, 0) (OK)\n",
+			    target_pid_to_str (lp->ptid),
+			    strsignal (WSTOPSIG (lp->status)));
+
+      delete_lwp (lp->ptid);
+    }
+
+  return 0;
+}
+
+static void
+lin_lwp_detach (char *args, int from_tty)
+{
+  iterate_over_lwps (detach_callback, NULL);
+
+  /* Only the initial process should be left right now.  */
+  gdb_assert (num_lwps == 1);
+
+  trap_ptid = null_ptid;
+
+  /* Destroy LWP info; it's no longer valid.  */
+  init_lwp_list ();
+
+  /* Restore the original signal mask.  */
+  sigprocmask (SIG_SETMASK, &normal_mask, NULL);
+  sigemptyset (&blocked_mask);
+
+  inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
+  child_ops.to_detach (args, from_tty);
+}
+
+
+/* Resume LP.  */
+
+static int
+resume_callback (struct lwp_info *lp, void *data)
+{
+  if (lp->stopped && lp->status == 0)
+    {
+      struct thread_info *tp;
+
+      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "RC:  PTRACE_CONT %s, 0, 0 (resume sibling)\n",
+			    target_pid_to_str (lp->ptid));
+      lp->stopped = 0;
+      lp->step = 0;
+    }
+
+  return 0;
+}
+
+static int
+resume_clear_callback (struct lwp_info *lp, void *data)
+{
+  lp->resumed = 0;
+  return 0;
+}
+
+static int
+resume_set_callback (struct lwp_info *lp, void *data)
+{
+  lp->resumed = 1;
+  return 0;
+}
+
+static void
+lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
+{
+  struct lwp_info *lp;
+  int resume_all;
+
+  /* A specific PTID means `step only this process id'.  */
+  resume_all = (PIDGET (ptid) == -1);
+
+  if (resume_all)
+    iterate_over_lwps (resume_set_callback, NULL);
+  else
+    iterate_over_lwps (resume_clear_callback, NULL);
+
+  /* If PID is -1, it's the current inferior that should be
+     handled specially.  */
+  if (PIDGET (ptid) == -1)
+    ptid = inferior_ptid;
+
+  lp = find_lwp_pid (ptid);
+  if (lp)
+    {
+      ptid = pid_to_ptid (GET_LWP (lp->ptid));
+
+      /* Remember if we're stepping.  */
+      lp->step = step;
+
+      /* Mark this LWP as resumed.  */
+      lp->resumed = 1;
+
+      /* If we have a pending wait status for this thread, there is no
+         point in resuming the process.  */
+      if (lp->status)
+	{
+	  /* FIXME: What should we do if we are supposed to continue
+	     this thread with a signal?  */
+	  gdb_assert (signo == TARGET_SIGNAL_0);
+	  return;
+	}
+
+      /* Mark LWP as not stopped to prevent it from being continued by
+         resume_callback.  */
+      lp->stopped = 0;
+    }
+
+  if (resume_all)
+    iterate_over_lwps (resume_callback, NULL);
+
+  child_resume (ptid, step, signo);
+  if (debug_lin_lwp)
+    fprintf_unfiltered (gdb_stdlog,
+			"LLR: %s %s, %s (resume event thread)\n",
+			step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+			target_pid_to_str (ptid),
+			signo ? strsignal (signo) : "0");
+}
+
+
+/* Issue kill to specified lwp.  */
+
+static int tkill_failed;
+
+static int
+kill_lwp (int lwpid, int signo)
+{
+  errno = 0;
+
+/* Use tkill, if possible, in case we are using nptl threads.  If tkill
+   fails, then we are not using nptl threads and we should be using kill.  */
+
+#ifdef HAVE_TKILL_SYSCALL
+  if (!tkill_failed)
+    {
+      int ret = syscall (__NR_tkill, lwpid, signo);
+      if (errno != ENOSYS)
+	return ret;
+      errno = 0;
+      tkill_failed = 1;
+    }
+#endif
+
+  return kill (lwpid, signo);
+}
+
+/* Handle a GNU/Linux extended wait response.  Most of the work we
+   just pass off to linux_handle_extended_wait, but if it reports a
+   clone event we need to add the new LWP to our list (and not report
+   the trap to higher layers).  This function returns non-zero if
+   the event should be ignored and we should wait again.  */
+
+static int
+lin_lwp_handle_extended (struct lwp_info *lp, int status)
+{
+  linux_handle_extended_wait (GET_LWP (lp->ptid), status,
+			      &lp->waitstatus);
+
+  /* TARGET_WAITKIND_SPURIOUS is used to indicate clone events.  */
+  if (lp->waitstatus.kind == TARGET_WAITKIND_SPURIOUS)
+    {
+      struct lwp_info *new_lp;
+      new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid,
+				   GET_PID (inferior_ptid)));
+      new_lp->cloned = 1;
+      new_lp->stopped = 1;
+
+      lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLHE: Got clone event from LWP %ld, resuming\n",
+			    GET_LWP (lp->ptid));
+      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+
+      return 1;
+    }
+
+  return 0;
+}
+
+/* Wait for LP to stop.  Returns the wait status, or 0 if the LWP has
+   exited.  */
+
+static int
+wait_lwp (struct lwp_info *lp)
+{
+  pid_t pid;
+  int status;
+  int thread_dead = 0;
+
+  gdb_assert (!lp->stopped);
+  gdb_assert (lp->status == 0);
+
+  pid = waitpid (GET_LWP (lp->ptid), &status, 0);
+  if (pid == -1 && errno == ECHILD)
+    {
+      pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
+      if (pid == -1 && errno == ECHILD)
+	{
+	  /* The thread has previously exited.  We need to delete it
+	     now because, for some vendor 2.4 kernels with NPTL
+	     support backported, there won't be an exit event unless
+	     it is the main thread.  2.6 kernels will report an exit
+	     event for each thread that exits, as expected.  */
+	  thread_dead = 1;
+	  if (debug_lin_lwp)
+	    fprintf_unfiltered (gdb_stdlog, "WL: %s vanished.\n",
+				target_pid_to_str (lp->ptid));
+	}
+    }
+
+  if (!thread_dead)
+    {
+      gdb_assert (pid == GET_LWP (lp->ptid));
+
+      if (debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "WL: waitpid %s received %s\n",
+			      target_pid_to_str (lp->ptid),
+			      status_to_str (status));
+	}
+    }
+
+  /* Check if the thread has exited.  */
+  if (WIFEXITED (status) || WIFSIGNALED (status))
+    {
+      thread_dead = 1;
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog, "WL: %s exited.\n",
+			    target_pid_to_str (lp->ptid));
+    }
+
+  if (thread_dead)
+    {
+      if (in_thread_list (lp->ptid))
+	{
+	  /* Core GDB cannot deal with us deleting the current thread.  */
+	  if (!ptid_equal (lp->ptid, inferior_ptid))
+	    delete_thread (lp->ptid);
+	  printf_unfiltered ("[%s exited]\n",
+			     target_pid_to_str (lp->ptid));
+	}
+
+      delete_lwp (lp->ptid);
+      return 0;
+    }
+
+  gdb_assert (WIFSTOPPED (status));
+
+  /* Handle GNU/Linux's extended waitstatus for trace events.  */
+  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
+    {
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "WL: Handling extended status 0x%06x\n",
+			    status);
+      if (lin_lwp_handle_extended (lp, status))
+	return wait_lwp (lp);
+    }
+
+  return status;
+}
+
+/* Send a SIGSTOP to LP.  */
+
+static int
+stop_callback (struct lwp_info *lp, void *data)
+{
+  if (!lp->stopped && !lp->signalled)
+    {
+      int ret;
+
+      if (debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "SC:  kill %s **<SIGSTOP>**\n",
+			      target_pid_to_str (lp->ptid));
+	}
+      errno = 0;
+      ret = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
+      if (debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "SC:  lwp kill %d %s\n",
+			      ret,
+			      errno ? safe_strerror (errno) : "ERRNO-OK");
+	}
+
+      lp->signalled = 1;
+      gdb_assert (lp->status == 0);
+    }
+
+  return 0;
+}
+
+/* Wait until LP is stopped.  If DATA is non-null it is interpreted as
+   a pointer to a set of signals to be flushed immediately.  */
+
+static int
+stop_wait_callback (struct lwp_info *lp, void *data)
+{
+  sigset_t *flush_mask = data;
+
+  if (!lp->stopped)
+    {
+      int status;
+
+      status = wait_lwp (lp);
+      if (status == 0)
+	return 0;
+
+      /* Ignore any signals in FLUSH_MASK.  */
+      if (flush_mask && sigismember (flush_mask, WSTOPSIG (status)))
+	{
+	  if (!lp->signalled)
+	    {
+	      lp->stopped = 1;
+	      return 0;
+	    }
+
+	  errno = 0;
+	  ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+	  if (debug_lin_lwp)
+	    fprintf_unfiltered (gdb_stdlog,
+				"PTRACE_CONT %s, 0, 0 (%s)\n",
+				target_pid_to_str (lp->ptid),
+				errno ? safe_strerror (errno) : "OK");
+
+	  return stop_wait_callback (lp, flush_mask);
+	}
+
+      if (WSTOPSIG (status) != SIGSTOP)
+	{
+	  if (WSTOPSIG (status) == SIGTRAP)
+	    {
+	      /* If a LWP other than the LWP that we're reporting an
+	         event for has hit a GDB breakpoint (as opposed to
+	         some random trap signal), then just arrange for it to
+	         hit it again later.  We don't keep the SIGTRAP status
+	         and don't forward the SIGTRAP signal to the LWP.  We
+	         will handle the current event, eventually we will
+	         resume all LWPs, and this one will get its breakpoint
+	         trap again.
+
+	         If we do not do this, then we run the risk that the
+	         user will delete or disable the breakpoint, but the
+	         thread will have already tripped on it.  */
+
+	      /* Now resume this LWP and get the SIGSTOP event. */
+	      errno = 0;
+	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+	      if (debug_lin_lwp)
+		{
+		  fprintf_unfiltered (gdb_stdlog,
+				      "PTRACE_CONT %s, 0, 0 (%s)\n",
+				      target_pid_to_str (lp->ptid),
+				      errno ? safe_strerror (errno) : "OK");
+
+		  fprintf_unfiltered (gdb_stdlog,
+				      "SWC: Candidate SIGTRAP event in %s\n",
+				      target_pid_to_str (lp->ptid));
+		}
+	      /* Hold the SIGTRAP for handling by lin_lwp_wait. */
+	      stop_wait_callback (lp, data);
+	      /* If there's another event, throw it back into the queue. */
+	      if (lp->status)
+		{
+		  if (debug_lin_lwp)
+		    {
+		      fprintf_unfiltered (gdb_stdlog,
+					  "SWC: kill %s, %s\n",
+					  target_pid_to_str (lp->ptid),
+					  status_to_str ((int) status));
+		    }
+		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+		}
+	      /* Save the sigtrap event. */
+	      lp->status = status;
+	      return 0;
+	    }
+	  else
+	    {
+	      /* The thread was stopped with a signal other than
+	         SIGSTOP, and didn't accidentally trip a breakpoint. */
+
+	      if (debug_lin_lwp)
+		{
+		  fprintf_unfiltered (gdb_stdlog,
+				      "SWC: Pending event %s in %s\n",
+				      status_to_str ((int) status),
+				      target_pid_to_str (lp->ptid));
+		}
+	      /* Now resume this LWP and get the SIGSTOP event. */
+	      errno = 0;
+	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
+				    target_pid_to_str (lp->ptid),
+				    errno ? safe_strerror (errno) : "OK");
+
+	      /* Hold this event/waitstatus while we check to see if
+	         there are any more (we still want to get that SIGSTOP). */
+	      stop_wait_callback (lp, data);
+	      /* If the lp->status field is still empty, use it to hold
+	         this event.  If not, then this event must be returned
+	         to the event queue of the LWP.  */
+	      if (lp->status == 0)
+		lp->status = status;
+	      else
+		{
+		  if (debug_lin_lwp)
+		    {
+		      fprintf_unfiltered (gdb_stdlog,
+					  "SWC: kill %s, %s\n",
+					  target_pid_to_str (lp->ptid),
+					  status_to_str ((int) status));
+		    }
+		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
+		}
+	      return 0;
+	    }
+	}
+      else
+	{
+	  /* We caught the SIGSTOP that we intended to catch, so
+	     there's no SIGSTOP pending.  */
+	  lp->stopped = 1;
+	  lp->signalled = 0;
+	}
+    }
+
+  return 0;
+}
+
+/* Check whether PID has any pending signals in FLUSH_MASK.  If so set
+   the appropriate bits in PENDING, and return 1 - otherwise return 0.  */
+
+static int
+lin_lwp_has_pending (int pid, sigset_t *pending, sigset_t *flush_mask)
+{
+  sigset_t blocked, ignored;
+  int i;
+
+  linux_proc_pending_signals (pid, pending, &blocked, &ignored);
+
+  if (!flush_mask)
+    return 0;
+
+  for (i = 1; i < NSIG; i++)
+    if (sigismember (pending, i))
+      if (!sigismember (flush_mask, i)
+	  || sigismember (&blocked, i)
+	  || sigismember (&ignored, i))
+	sigdelset (pending, i);
+
+  if (sigisemptyset (pending))
+    return 0;
+
+  return 1;
+}
+
+/* DATA is interpreted as a mask of signals to flush.  If LP has
+   signals pending, and they are all in the flush mask, then arrange
+   to flush them.  LP should be stopped, as should all other threads
+   it might share a signal queue with.  */
+
+static int
+flush_callback (struct lwp_info *lp, void *data)
+{
+  sigset_t *flush_mask = data;
+  sigset_t pending, intersection, blocked, ignored;
+  int pid, status;
+
+  /* Normally, when an LWP exits, it is removed from the LWP list.  The
+     last LWP isn't removed till later, however.  So if there is only
+     one LWP on the list, make sure it's alive.  */
+  if (lwp_list == lp && lp->next == NULL)
+    if (!lin_lwp_thread_alive (lp->ptid))
+      return 0;
+
+  /* Just because the LWP is stopped doesn't mean that new signals
+     can't arrive from outside, so this function must be careful of
+     race conditions.  However, because all threads are stopped, we
+     can assume that the pending mask will not shrink unless we resume
+     the LWP, and that it will then get another signal.  We can't
+     control which one, however.  */
+
+  if (lp->status)
+    {
+      if (debug_lin_lwp)
+	printf_unfiltered ("FC: LP has pending status %06x\n", lp->status);
+      if (WIFSTOPPED (lp->status) && sigismember (flush_mask, WSTOPSIG (lp->status)))
+	lp->status = 0;
+    }
+
+  while (lin_lwp_has_pending (GET_LWP (lp->ptid), &pending, flush_mask))
+    {
+      int ret;
+      
+      errno = 0;
+      ret = ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stderr,
+			    "FC: Sent PTRACE_CONT, ret %d %d\n", ret, errno);
+
+      lp->stopped = 0;
+      stop_wait_callback (lp, flush_mask);
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stderr,
+			    "FC: Wait finished; saved status is %d\n",
+			    lp->status);
+    }
+
+  return 0;
+}
+
+/* Return non-zero if LP has a wait status pending.  */
+
+static int
+status_callback (struct lwp_info *lp, void *data)
+{
+  /* Only report a pending wait status if we pretend that this has
+     indeed been resumed.  */
+  return (lp->status != 0 && lp->resumed);
+}
+
+/* Return non-zero if LP isn't stopped.  */
+
+static int
+running_callback (struct lwp_info *lp, void *data)
+{
+  return (lp->stopped == 0 || (lp->status != 0 && lp->resumed));
+}
+
+/* Count the LWP's that have had events.  */
+
+static int
+count_events_callback (struct lwp_info *lp, void *data)
+{
+  int *count = data;
+
+  gdb_assert (count != NULL);
+
+  /* Count only LWPs that have a SIGTRAP event pending.  */
+  if (lp->status != 0
+      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+    (*count)++;
+
+  return 0;
+}
+
+/* Select the LWP (if any) that is currently being single-stepped.  */
+
+static int
+select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
+{
+  if (lp->step && lp->status != 0)
+    return 1;
+  else
+    return 0;
+}
+
+/* Select the Nth LWP that has had a SIGTRAP event.  */
+
+static int
+select_event_lwp_callback (struct lwp_info *lp, void *data)
+{
+  int *selector = data;
+
+  gdb_assert (selector != NULL);
+
+  /* Select only LWPs that have a SIGTRAP event pending. */
+  if (lp->status != 0
+      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+    if ((*selector)-- == 0)
+      return 1;
+
+  return 0;
+}
+
+static int
+cancel_breakpoints_callback (struct lwp_info *lp, void *data)
+{
+  struct lwp_info *event_lp = data;
+
+  /* Leave the LWP that has been elected to receive a SIGTRAP alone.  */
+  if (lp == event_lp)
+    return 0;
+
+  /* If a LWP other than the LWP that we're reporting an event for has
+     hit a GDB breakpoint (as opposed to some random trap signal),
+     then just arrange for it to hit it again later.  We don't keep
+     the SIGTRAP status and don't forward the SIGTRAP signal to the
+     LWP.  We will handle the current event, eventually we will resume
+     all LWPs, and this one will get its breakpoint trap again.
+
+     If we do not do this, then we run the risk that the user will
+     delete or disable the breakpoint, but the LWP will have already
+     tripped on it.  */
+
+  if (lp->status != 0
+      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
+      && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
+				     DECR_PC_AFTER_BREAK))
+    {
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "CBC: Push back breakpoint for %s\n",
+			    target_pid_to_str (lp->ptid));
+
+      /* Back up the PC if necessary.  */
+      if (DECR_PC_AFTER_BREAK)
+	write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid);
+
+      /* Throw away the SIGTRAP.  */
+      lp->status = 0;
+    }
+
+  return 0;
+}
+
+/* Select one LWP out of those that have events pending.  */
+
+static void
+select_event_lwp (struct lwp_info **orig_lp, int *status)
+{
+  int num_events = 0;
+  int random_selector;
+  struct lwp_info *event_lp;
+
+  /* Record the wait status for the origional LWP.  */
+  (*orig_lp)->status = *status;
+
+  /* Give preference to any LWP that is being single-stepped.  */
+  event_lp = iterate_over_lwps (select_singlestep_lwp_callback, NULL);
+  if (event_lp != NULL)
+    {
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "SEL: Select single-step %s\n",
+			    target_pid_to_str (event_lp->ptid));
+    }
+  else
+    {
+      /* No single-stepping LWP.  Select one at random, out of those
+         which have had SIGTRAP events.  */
+
+      /* First see how many SIGTRAP events we have.  */
+      iterate_over_lwps (count_events_callback, &num_events);
+
+      /* Now randomly pick a LWP out of those that have had a SIGTRAP.  */
+      random_selector = (int)
+	((num_events * (double) rand ()) / (RAND_MAX + 1.0));
+
+      if (debug_lin_lwp && num_events > 1)
+	fprintf_unfiltered (gdb_stdlog,
+			    "SEL: Found %d SIGTRAP events, selecting #%d\n",
+			    num_events, random_selector);
+
+      event_lp = iterate_over_lwps (select_event_lwp_callback,
+				    &random_selector);
+    }
+
+  if (event_lp != NULL)
+    {
+      /* Switch the event LWP.  */
+      *orig_lp = event_lp;
+      *status = event_lp->status;
+    }
+
+  /* Flush the wait status for the event LWP.  */
+  (*orig_lp)->status = 0;
+}
+
+/* Return non-zero if LP has been resumed.  */
+
+static int
+resumed_callback (struct lwp_info *lp, void *data)
+{
+  return lp->resumed;
+}
+
+#ifdef CHILD_WAIT
+
+/* We need to override child_wait to support attaching to cloned
+   processes, since a normal wait (as done by the default version)
+   ignores those processes.  */
+
+/* Wait for child PTID to do something.  Return id of the child,
+   minus_one_ptid in case of error; store status into *OURSTATUS.  */
+
+ptid_t
+child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+{
+  int save_errno;
+  int status;
+  pid_t pid;
+
+  ourstatus->kind = TARGET_WAITKIND_IGNORE;
+
+  do
+    {
+      set_sigint_trap ();	/* Causes SIGINT to be passed on to the
+				   attached process.  */
+      set_sigio_trap ();
+
+      pid = waitpid (GET_PID (ptid), &status, 0);
+      if (pid == -1 && errno == ECHILD)
+	/* Try again with __WCLONE to check cloned processes.  */
+	pid = waitpid (GET_PID (ptid), &status, __WCLONE);
+
+      if (debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "CW:  waitpid %ld received %s\n",
+			      (long) pid, status_to_str (status));
+	}
+
+      save_errno = errno;
+
+      /* Make sure we don't report an event for the exit of the
+         original program, if we've detached from it.  */
+      if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
+	{
+	  pid = -1;
+	  save_errno = EINTR;
+	}
+
+      /* Check for stop events reported by a process we didn't already
+	 know about - in this case, anything other than inferior_ptid.
+
+	 If we're expecting to receive stopped processes after fork,
+	 vfork, and clone events, then we'll just add the new one to
+	 our list and go back to waiting for the event to be reported
+	 - the stopped process might be returned from waitpid before
+	 or after the event is.  If we want to handle debugging of
+	 CLONE_PTRACE processes we need to do more here, i.e. switch
+	 to multi-threaded mode.  */
+      if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP
+	  && pid != GET_PID (inferior_ptid))
+	{
+	  linux_record_stopped_pid (pid);
+	  pid = -1;
+	  save_errno = EINTR;
+	}
+
+      /* Handle GNU/Linux's extended waitstatus for trace events.  */
+      if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP
+	  && status >> 16 != 0)
+	{
+	  linux_handle_extended_wait (pid, status, ourstatus);
+
+	  /* If we see a clone event, detach the child, and don't
+	     report the event.  It would be nice to offer some way to
+	     switch into a non-thread-db based threaded mode at this
+	     point.  */
+	  if (ourstatus->kind == TARGET_WAITKIND_SPURIOUS)
+	    {
+	      ptrace (PTRACE_DETACH, ourstatus->value.related_pid, 0, 0);
+	      ourstatus->kind = TARGET_WAITKIND_IGNORE;
+	      ptrace (PTRACE_CONT, pid, 0, 0);
+	      pid = -1;
+	      save_errno = EINTR;
+	    }
+	}
+
+      clear_sigio_trap ();
+      clear_sigint_trap ();
+    }
+  while (pid == -1 && save_errno == EINTR);
+
+  if (pid == -1)
+    {
+      warning ("Child process unexpectedly missing: %s",
+	       safe_strerror (errno));
+
+      /* Claim it exited with unknown signal.  */
+      ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+      ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+      return minus_one_ptid;
+    }
+
+  if (ourstatus->kind == TARGET_WAITKIND_IGNORE)
+    store_waitstatus (ourstatus, status);
+
+  return pid_to_ptid (pid);
+}
+
+#endif
+
+/* Stop an active thread, verify it still exists, then resume it.  */
+
+static int
+stop_and_resume_callback (struct lwp_info *lp, void *data)
+{
+  struct lwp_info *ptr;
+
+  if (!lp->stopped && !lp->signalled)
+    {
+      stop_callback (lp, NULL);
+      stop_wait_callback (lp, NULL);
+      /* Resume if the lwp still exists.  */
+      for (ptr = lwp_list; ptr; ptr = ptr->next)
+	if (lp == ptr)
+	  {
+	    resume_callback (lp, NULL);
+	    resume_set_callback (lp, NULL);
+	  }
+    }
+  return 0;
+}
+
+static ptid_t
+lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+{
+  struct lwp_info *lp = NULL;
+  int options = 0;
+  int status = 0;
+  pid_t pid = PIDGET (ptid);
+  sigset_t flush_mask;
+
+  sigemptyset (&flush_mask);
+
+  /* Make sure SIGCHLD is blocked.  */
+  if (!sigismember (&blocked_mask, SIGCHLD))
+    {
+      sigaddset (&blocked_mask, SIGCHLD);
+      sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+    }
+
+retry:
+
+  /* Make sure there is at least one LWP that has been resumed, at
+     least if there are any LWPs at all.  */
+  gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL));
+
+  /* First check if there is a LWP with a wait status pending.  */
+  if (pid == -1)
+    {
+      /* Any LWP that's been resumed will do.  */
+      lp = iterate_over_lwps (status_callback, NULL);
+      if (lp)
+	{
+	  status = lp->status;
+	  lp->status = 0;
+
+	  if (debug_lin_lwp && status)
+	    fprintf_unfiltered (gdb_stdlog,
+				"LLW: Using pending wait status %s for %s.\n",
+				status_to_str (status),
+				target_pid_to_str (lp->ptid));
+	}
+
+      /* But if we don't fine one, we'll have to wait, and check both
+         cloned and uncloned processes.  We start with the cloned
+         processes.  */
+      options = __WCLONE | WNOHANG;
+    }
+  else if (is_lwp (ptid))
+    {
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLW: Waiting for specific LWP %s.\n",
+			    target_pid_to_str (ptid));
+
+      /* We have a specific LWP to check.  */
+      lp = find_lwp_pid (ptid);
+      gdb_assert (lp);
+      status = lp->status;
+      lp->status = 0;
+
+      if (debug_lin_lwp && status)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLW: Using pending wait status %s for %s.\n",
+			    status_to_str (status),
+			    target_pid_to_str (lp->ptid));
+
+      /* If we have to wait, take into account whether PID is a cloned
+         process or not.  And we have to convert it to something that
+         the layer beneath us can understand.  */
+      options = lp->cloned ? __WCLONE : 0;
+      pid = GET_LWP (ptid);
+    }
+
+  if (status && lp->signalled)
+    {
+      /* A pending SIGSTOP may interfere with the normal stream of
+         events.  In a typical case where interference is a problem,
+         we have a SIGSTOP signal pending for LWP A while
+         single-stepping it, encounter an event in LWP B, and take the
+         pending SIGSTOP while trying to stop LWP A.  After processing
+         the event in LWP B, LWP A is continued, and we'll never see
+         the SIGTRAP associated with the last time we were
+         single-stepping LWP A.  */
+
+      /* Resume the thread.  It should halt immediately returning the
+         pending SIGSTOP.  */
+      registers_changed ();
+      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
+		    TARGET_SIGNAL_0);
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
+			    lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+			    target_pid_to_str (lp->ptid));
+      lp->stopped = 0;
+      gdb_assert (lp->resumed);
+
+      /* This should catch the pending SIGSTOP.  */
+      stop_wait_callback (lp, NULL);
+    }
+
+  set_sigint_trap ();		/* Causes SIGINT to be passed on to the
+				   attached process. */
+  set_sigio_trap ();
+
+  while (status == 0)
+    {
+      pid_t lwpid;
+
+      lwpid = waitpid (pid, &status, options);
+      if (lwpid > 0)
+	{
+	  gdb_assert (pid == -1 || lwpid == pid);
+
+	  if (debug_lin_lwp)
+	    {
+	      fprintf_unfiltered (gdb_stdlog,
+				  "LLW: waitpid %ld received %s\n",
+				  (long) lwpid, status_to_str (status));
+	    }
+
+	  lp = find_lwp_pid (pid_to_ptid (lwpid));
+
+	  /* Check for stop events reported by a process we didn't
+	     already know about - anything not already in our LWP
+	     list.
+
+	     If we're expecting to receive stopped processes after
+	     fork, vfork, and clone events, then we'll just add the
+	     new one to our list and go back to waiting for the event
+	     to be reported - the stopped process might be returned
+	     from waitpid before or after the event is.  */
+	  if (WIFSTOPPED (status) && !lp)
+	    {
+	      linux_record_stopped_pid (lwpid);
+	      status = 0;
+	      continue;
+	    }
+
+	  /* Make sure we don't report an event for the exit of an LWP not in
+	     our list, i.e.  not part of the current process.  This can happen
+	     if we detach from a program we original forked and then it
+	     exits.  */
+	  if (!WIFSTOPPED (status) && !lp)
+	    {
+	      status = 0;
+	      continue;
+	    }
+
+	  /* NOTE drow/2003-06-17: This code seems to be meant for debugging
+	     CLONE_PTRACE processes which do not use the thread library -
+	     otherwise we wouldn't find the new LWP this way.  That doesn't
+	     currently work, and the following code is currently unreachable
+	     due to the two blocks above.  If it's fixed some day, this code
+	     should be broken out into a function so that we can also pick up
+	     LWPs from the new interface.  */
+	  if (!lp)
+	    {
+	      lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
+	      if (options & __WCLONE)
+		lp->cloned = 1;
+
+	      if (threaded)
+		{
+		  gdb_assert (WIFSTOPPED (status)
+			      && WSTOPSIG (status) == SIGSTOP);
+		  lp->signalled = 1;
+
+		  if (!in_thread_list (inferior_ptid))
+		    {
+		      inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
+						 GET_PID (inferior_ptid));
+		      add_thread (inferior_ptid);
+		    }
+
+		  add_thread (lp->ptid);
+		  printf_unfiltered ("[New %s]\n",
+				     target_pid_to_str (lp->ptid));
+		}
+	    }
+
+	  /* Handle GNU/Linux's extended waitstatus for trace events.  */
+	  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
+	    {
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "LLW: Handling extended status 0x%06x\n",
+				    status);
+	      if (lin_lwp_handle_extended (lp, status))
+		{
+		  status = 0;
+		  continue;
+		}
+	    }
+
+	  /* Check if the thread has exited.  */
+	  if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
+	    {
+	      if (in_thread_list (lp->ptid))
+		{
+		  /* Core GDB cannot deal with us deleting the current
+		     thread.  */
+		  if (!ptid_equal (lp->ptid, inferior_ptid))
+		    delete_thread (lp->ptid);
+		  printf_unfiltered ("[%s exited]\n",
+				     target_pid_to_str (lp->ptid));
+		}
+
+	      /* If this is the main thread, we must stop all threads and
+	         verify if they are still alive.  This is because in the nptl
+	         thread model, there is no signal issued for exiting LWPs
+	         other than the main thread.  We only get the main thread
+	         exit signal once all child threads have already exited.
+	         If we stop all the threads and use the stop_wait_callback
+	         to check if they have exited we can determine whether this
+	         signal should be ignored or whether it means the end of the
+	         debugged application, regardless of which threading model
+	         is being used.  */
+	      if (GET_PID (lp->ptid) == GET_LWP (lp->ptid))
+		{
+		  lp->stopped = 1;
+		  iterate_over_lwps (stop_and_resume_callback, NULL);
+		}
+
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "LLW: %s exited.\n",
+				    target_pid_to_str (lp->ptid));
+
+	      delete_lwp (lp->ptid);
+
+	      /* If there is at least one more LWP, then the exit signal
+	         was not the end of the debugged application and should be
+	         ignored.  */
+	      if (num_lwps > 0)
+		{
+		  /* Make sure there is at least one thread running.  */
+		  gdb_assert (iterate_over_lwps (running_callback, NULL));
+
+		  /* Discard the event.  */
+		  status = 0;
+		  continue;
+		}
+	    }
+
+	  /* Check if the current LWP has previously exited.  In the nptl
+	     thread model, LWPs other than the main thread do not issue
+	     signals when they exit so we must check whenever the thread
+	     has stopped.  A similar check is made in stop_wait_callback().  */
+	  if (num_lwps > 1 && !lin_lwp_thread_alive (lp->ptid))
+	    {
+	      if (in_thread_list (lp->ptid))
+		{
+		  /* Core GDB cannot deal with us deleting the current
+		     thread.  */
+		  if (!ptid_equal (lp->ptid, inferior_ptid))
+		    delete_thread (lp->ptid);
+		  printf_unfiltered ("[%s exited]\n",
+				     target_pid_to_str (lp->ptid));
+		}
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "LLW: %s exited.\n",
+				    target_pid_to_str (lp->ptid));
+
+	      delete_lwp (lp->ptid);
+
+	      /* Make sure there is at least one thread running.  */
+	      gdb_assert (iterate_over_lwps (running_callback, NULL));
+
+	      /* Discard the event.  */
+	      status = 0;
+	      continue;
+	    }
+
+	  /* Make sure we don't report a SIGSTOP that we sent
+	     ourselves in an attempt to stop an LWP.  */
+	  if (lp->signalled
+	      && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
+	    {
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "LLW: Delayed SIGSTOP caught for %s.\n",
+				    target_pid_to_str (lp->ptid));
+
+	      /* This is a delayed SIGSTOP.  */
+	      lp->signalled = 0;
+
+	      registers_changed ();
+	      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
+			    TARGET_SIGNAL_0);
+	      if (debug_lin_lwp)
+		fprintf_unfiltered (gdb_stdlog,
+				    "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
+				    lp->step ?
+				    "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+				    target_pid_to_str (lp->ptid));
+
+	      lp->stopped = 0;
+	      gdb_assert (lp->resumed);
+
+	      /* Discard the event.  */
+	      status = 0;
+	      continue;
+	    }
+
+	  break;
+	}
+
+      if (pid == -1)
+	{
+	  /* Alternate between checking cloned and uncloned processes.  */
+	  options ^= __WCLONE;
+
+	  /* And suspend every time we have checked both.  */
+	  if (options & __WCLONE)
+	    sigsuspend (&suspend_mask);
+	}
+
+      /* We shouldn't end up here unless we want to try again.  */
+      gdb_assert (status == 0);
+    }
+
+  clear_sigio_trap ();
+  clear_sigint_trap ();
+
+  gdb_assert (lp);
+
+  /* Don't report signals that GDB isn't interested in, such as
+     signals that are neither printed nor stopped upon.  Stopping all
+     threads can be a bit time-consuming so if we want decent
+     performance with heavily multi-threaded programs, especially when
+     they're using a high frequency timer, we'd better avoid it if we
+     can.  */
+
+  if (WIFSTOPPED (status))
+    {
+      int signo = target_signal_from_host (WSTOPSIG (status));
+
+      if (signal_stop_state (signo) == 0
+	  && signal_print_state (signo) == 0
+	  && signal_pass_state (signo) == 1)
+	{
+	  /* FIMXE: kettenis/2001-06-06: Should we resume all threads
+	     here?  It is not clear we should.  GDB may not expect
+	     other threads to run.  On the other hand, not resuming
+	     newly attached threads may cause an unwanted delay in
+	     getting them running.  */
+	  registers_changed ();
+	  child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+	  if (debug_lin_lwp)
+	    fprintf_unfiltered (gdb_stdlog,
+				"LLW: %s %s, %s (preempt 'handle')\n",
+				lp->step ?
+				"PTRACE_SINGLESTEP" : "PTRACE_CONT",
+				target_pid_to_str (lp->ptid),
+				signo ? strsignal (signo) : "0");
+	  lp->stopped = 0;
+	  status = 0;
+	  goto retry;
+	}
+
+      if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
+	{
+	  /* If ^C/BREAK is typed at the tty/console, SIGINT gets
+	     forwarded to the entire process group, that is, all LWP's
+	     will receive it.  Since we only want to report it once,
+	     we try to flush it from all LWPs except this one.  */
+	  sigaddset (&flush_mask, SIGINT);
+	}
+    }
+
+  /* This LWP is stopped now.  */
+  lp->stopped = 1;
+
+  if (debug_lin_lwp)
+    fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
+			status_to_str (status), target_pid_to_str (lp->ptid));
+
+  /* Now stop all other LWP's ...  */
+  iterate_over_lwps (stop_callback, NULL);
+
+  /* ... and wait until all of them have reported back that they're no
+     longer running.  */
+  iterate_over_lwps (stop_wait_callback, &flush_mask);
+  iterate_over_lwps (flush_callback, &flush_mask);
+
+  /* If we're not waiting for a specific LWP, choose an event LWP from
+     among those that have had events.  Giving equal priority to all
+     LWPs that have had events helps prevent starvation.  */
+  if (pid == -1)
+    select_event_lwp (&lp, &status);
+
+  /* Now that we've selected our final event LWP, cancel any
+     breakpoints in other LWPs that have hit a GDB breakpoint.  See
+     the comment in cancel_breakpoints_callback to find out why.  */
+  iterate_over_lwps (cancel_breakpoints_callback, lp);
+
+  /* If we're not running in "threaded" mode, we'll report the bare
+     process id.  */
+
+  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+    {
+      trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
+      if (debug_lin_lwp)
+	fprintf_unfiltered (gdb_stdlog,
+			    "LLW: trap_ptid is %s.\n",
+			    target_pid_to_str (trap_ptid));
+    }
+  else
+    trap_ptid = null_ptid;
+
+  if (lp->waitstatus.kind != TARGET_WAITKIND_IGNORE)
+    {
+      *ourstatus = lp->waitstatus;
+      lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+    }
+  else
+    store_waitstatus (ourstatus, status);
+
+  return (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
+}
+
+static int
+kill_callback (struct lwp_info *lp, void *data)
+{
+  errno = 0;
+  ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
+  if (debug_lin_lwp)
+    fprintf_unfiltered (gdb_stdlog,
+			"KC:  PTRACE_KILL %s, 0, 0 (%s)\n",
+			target_pid_to_str (lp->ptid),
+			errno ? safe_strerror (errno) : "OK");
+
+  return 0;
+}
+
+static int
+kill_wait_callback (struct lwp_info *lp, void *data)
+{
+  pid_t pid;
+
+  /* We must make sure that there are no pending events (delayed
+     SIGSTOPs, pending SIGTRAPs, etc.) to make sure the current
+     program doesn't interfere with any following debugging session.  */
+
+  /* For cloned processes we must check both with __WCLONE and
+     without, since the exit status of a cloned process isn't reported
+     with __WCLONE.  */
+  if (lp->cloned)
+    {
+      do
+	{
+	  pid = waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
+	  if (pid != (pid_t) -1 && debug_lin_lwp)
+	    {
+	      fprintf_unfiltered (gdb_stdlog,
+				  "KWC: wait %s received unknown.\n",
+				  target_pid_to_str (lp->ptid));
+	    }
+	}
+      while (pid == GET_LWP (lp->ptid));
+
+      gdb_assert (pid == -1 && errno == ECHILD);
+    }
+
+  do
+    {
+      pid = waitpid (GET_LWP (lp->ptid), NULL, 0);
+      if (pid != (pid_t) -1 && debug_lin_lwp)
+	{
+	  fprintf_unfiltered (gdb_stdlog,
+			      "KWC: wait %s received unk.\n",
+			      target_pid_to_str (lp->ptid));
+	}
+    }
+  while (pid == GET_LWP (lp->ptid));
+
+  gdb_assert (pid == -1 && errno == ECHILD);
+  return 0;
+}
+
+static void
+lin_lwp_kill (void)
+{
+  /* Kill all LWP's ...  */
+  iterate_over_lwps (kill_callback, NULL);
+
+  /* ... and wait until we've flushed all events.  */
+  iterate_over_lwps (kill_wait_callback, NULL);
+
+  target_mourn_inferior ();
+}
+
+static void
+lin_lwp_create_inferior (char *exec_file, char *allargs, char **env,
+			 int from_tty)
+{
+  child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+}
+
+static void
+lin_lwp_mourn_inferior (void)
+{
+  trap_ptid = null_ptid;
+
+  /* Destroy LWP info; it's no longer valid.  */
+  init_lwp_list ();
+
+  /* Restore the original signal mask.  */
+  sigprocmask (SIG_SETMASK, &normal_mask, NULL);
+  sigemptyset (&blocked_mask);
+
+  child_ops.to_mourn_inferior ();
+}
+
+static int
+lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		     struct mem_attrib *attrib, struct target_ops *target)
+{
+  struct cleanup *old_chain = save_inferior_ptid ();
+  int xfer;
+
+  if (is_lwp (inferior_ptid))
+    inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
+
+  xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+  if (xfer == 0)
+    xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+
+  do_cleanups (old_chain);
+  return xfer;
+}
+
+static int
+lin_lwp_thread_alive (ptid_t ptid)
+{
+  gdb_assert (is_lwp (ptid));
+
+  errno = 0;
+  ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
+  if (debug_lin_lwp)
+    fprintf_unfiltered (gdb_stdlog,
+			"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
+			target_pid_to_str (ptid),
+			errno ? safe_strerror (errno) : "OK");
+  if (errno)
+    return 0;
+
+  return 1;
+}
+
+static char *
+lin_lwp_pid_to_str (ptid_t ptid)
+{
+  static char buf[64];
+
+  if (is_lwp (ptid))
+    {
+      snprintf (buf, sizeof (buf), "LWP %ld", GET_LWP (ptid));
+      return buf;
+    }
+
+  return normal_pid_to_str (ptid);
+}
+
+static void
+init_lin_lwp_ops (void)
+{
+#if 0
+  lin_lwp_ops.to_open = lin_lwp_open;
+#endif
+  lin_lwp_ops.to_shortname = "lwp-layer";
+  lin_lwp_ops.to_longname = "lwp-layer";
+  lin_lwp_ops.to_doc = "Low level threads support (LWP layer)";
+  lin_lwp_ops.to_attach = lin_lwp_attach;
+  lin_lwp_ops.to_detach = lin_lwp_detach;
+  lin_lwp_ops.to_resume = lin_lwp_resume;
+  lin_lwp_ops.to_wait = lin_lwp_wait;
+  /* fetch_inferior_registers and store_inferior_registers will
+     honor the LWP id, so we can use them directly.  */
+  lin_lwp_ops.to_fetch_registers = fetch_inferior_registers;
+  lin_lwp_ops.to_store_registers = store_inferior_registers;
+  lin_lwp_ops.to_xfer_memory = lin_lwp_xfer_memory;
+  lin_lwp_ops.to_kill = lin_lwp_kill;
+  lin_lwp_ops.to_create_inferior = lin_lwp_create_inferior;
+  lin_lwp_ops.to_mourn_inferior = lin_lwp_mourn_inferior;
+  lin_lwp_ops.to_thread_alive = lin_lwp_thread_alive;
+  lin_lwp_ops.to_pid_to_str = lin_lwp_pid_to_str;
+  lin_lwp_ops.to_post_startup_inferior = child_post_startup_inferior;
+  lin_lwp_ops.to_post_attach = child_post_attach;
+  lin_lwp_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+  lin_lwp_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+  lin_lwp_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+
+  lin_lwp_ops.to_stratum = thread_stratum;
+  lin_lwp_ops.to_has_thread_control = tc_schedlock;
+  lin_lwp_ops.to_magic = OPS_MAGIC;
+}
+
+static void
+sigchld_handler (int signo)
+{
+  /* Do nothing.  The only reason for this handler is that it allows
+     us to use sigsuspend in lin_lwp_wait above to wait for the
+     arrival of a SIGCHLD.  */
+}
+
+void
+_initialize_lin_lwp (void)
+{
+  struct sigaction action;
+
+  extern void thread_db_init (struct target_ops *);
+
+  init_lin_lwp_ops ();
+  add_target (&lin_lwp_ops);
+  thread_db_init (&lin_lwp_ops);
+
+  /* Save the original signal mask.  */
+  sigprocmask (SIG_SETMASK, NULL, &normal_mask);
+
+  action.sa_handler = sigchld_handler;
+  sigemptyset (&action.sa_mask);
+  action.sa_flags = 0;
+  sigaction (SIGCHLD, &action, NULL);
+
+  /* Make sure we don't block SIGCHLD during a sigsuspend.  */
+  sigprocmask (SIG_SETMASK, NULL, &suspend_mask);
+  sigdelset (&suspend_mask, SIGCHLD);
+
+  sigemptyset (&blocked_mask);
+
+  deprecated_add_show_from_set
+    (add_set_cmd ("lin-lwp", no_class, var_zinteger,
+		  (char *) &debug_lin_lwp,
+		  "Set debugging of GNU/Linux lwp module.\n\
+Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
+}
+
+
+/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
+   the GNU/Linux Threads library and therefore doesn't really belong
+   here.  */
+
+/* Read variable NAME in the target and return its value if found.
+   Otherwise return zero.  It is assumed that the type of the variable
+   is `int'.  */
+
+static int
+get_signo (const char *name)
+{
+  struct minimal_symbol *ms;
+  int signo;
+
+  ms = lookup_minimal_symbol (name, NULL, NULL);
+  if (ms == NULL)
+    return 0;
+
+  if (target_read_memory (SYMBOL_VALUE_ADDRESS (ms), (char *) &signo,
+			  sizeof (signo)) != 0)
+    return 0;
+
+  return signo;
+}
+
+/* Return the set of signals used by the threads library in *SET.  */
+
+void
+lin_thread_get_thread_signals (sigset_t *set)
+{
+  struct sigaction action;
+  int restart, cancel;
+
+  sigemptyset (set);
+
+  restart = get_signo ("__pthread_sig_restart");
+  if (restart == 0)
+    return;
+
+  cancel = get_signo ("__pthread_sig_cancel");
+  if (cancel == 0)
+    return;
+
+  sigaddset (set, restart);
+  sigaddset (set, cancel);
+
+  /* The GNU/Linux Threads library makes terminating threads send a
+     special "cancel" signal instead of SIGCHLD.  Make sure we catch
+     those (to prevent them from terminating GDB itself, which is
+     likely to be their default action) and treat them the same way as
+     SIGCHLD.  */
+
+  action.sa_handler = sigchld_handler;
+  sigemptyset (&action.sa_mask);
+  action.sa_flags = 0;
+  sigaction (cancel, &action, NULL);
+
+  /* We block the "cancel" signal throughout this code ...  */
+  sigaddset (&blocked_mask, cancel);
+  sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+
+  /* ... except during a sigsuspend.  */
+  sigdelset (&suspend_mask, cancel);
+}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 9c40f77..15b6704 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1,6 +1,5 @@
 /* GNU/Linux native-dependent code common to multiple platforms.
-
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,31 +21,11 @@
 #include "defs.h"
 #include "inferior.h"
 #include "target.h"
-#include "gdb_string.h"
-#include "gdb_wait.h"
-#include "gdb_assert.h"
-#ifdef HAVE_TKILL_SYSCALL
-#include <unistd.h>
-#include <sys/syscall.h>
-#endif
-#include <sys/ptrace.h>
-#include "linux-nat.h"
-#include "gdbthread.h"
-#include "gdbcmd.h"
-#include "regcache.h"
-#include <sys/param.h>		/* for MAXPATHLEN */
-#include <sys/procfs.h>		/* for elf_gregset etc. */
-#include "elf-bfd.h"		/* for elfcore_write_* */
-#include "gregset.h"		/* for gregset */
-#include "gdbcore.h"		/* for get_exec_file */
-#include <ctype.h>		/* for isdigit */
-#include "gdbthread.h"		/* for struct thread_info etc. */
-#include "gdb_stat.h"		/* for struct stat */
-#include <fcntl.h>		/* for O_RDONLY */
 
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
+#include "gdb_wait.h"
+#include <sys/ptrace.h>
+
+#include "linux-nat.h"
 
 /* If the system headers did not provide the constants, hard-code the normal
    values.  */
@@ -81,7 +60,7 @@
 #define __WALL          0x40000000 /* Wait for any child.  */
 #endif
 
-static int debug_linux_nat;
+extern struct target_ops child_ops;
 
 static int linux_parent_pid;
 
@@ -398,7 +377,7 @@
 	target_detach (NULL, 0);
 
       inferior_ptid = pid_to_ptid (child_pid);
-      push_target (&deprecated_child_ops);
+      push_target (&child_ops);
 
       /* Reset breakpoints in the child as appropriate.  */
       follow_inferior_reset_breakpoints ();
@@ -522,12 +501,12 @@
       || last.kind == TARGET_WAITKIND_VFORKED)
     {
       ptrace (PT_KILL, last.value.related_pid, 0, 0);
-      wait (&status);
+      ptrace_wait (null_ptid, &status);
     }
 
   /* Kill the current process.  */
   ptrace (PT_KILL, pid, 0, 0);
-  ret = wait (&status);
+  ret = ptrace_wait (null_ptid, &status);
 
   /* We might get a SIGCHLD instead of an exit status.  This is
      aggravated by the first kill above - a child has just died.  */
@@ -535,2582 +514,8 @@
   while (ret == pid && WIFSTOPPED (status))
     {
       ptrace (PT_KILL, pid, 0, 0);
-      ret = wait (&status);
+      ret = ptrace_wait (null_ptid, &status);
     }
 
   target_mourn_inferior ();
 }
-
-/* On GNU/Linux there are no real LWP's.  The closest thing to LWP's
-   are processes sharing the same VM space.  A multi-threaded process
-   is basically a group of such processes.  However, such a grouping
-   is almost entirely a user-space issue; the kernel doesn't enforce
-   such a grouping at all (this might change in the future).  In
-   general, we'll rely on the threads library (i.e. the GNU/Linux
-   Threads library) to provide such a grouping.
-
-   It is perfectly well possible to write a multi-threaded application
-   without the assistance of a threads library, by using the clone
-   system call directly.  This module should be able to give some
-   rudimentary support for debugging such applications if developers
-   specify the CLONE_PTRACE flag in the clone system call, and are
-   using the Linux kernel 2.4 or above.
-
-   Note that there are some peculiarities in GNU/Linux that affect
-   this code:
-
-   - In general one should specify the __WCLONE flag to waitpid in
-     order to make it report events for any of the cloned processes
-     (and leave it out for the initial process).  However, if a cloned
-     process has exited the exit status is only reported if the
-     __WCLONE flag is absent.  Linux kernel 2.4 has a __WALL flag, but
-     we cannot use it since GDB must work on older systems too.
-
-   - When a traced, cloned process exits and is waited for by the
-     debugger, the kernel reassigns it to the original parent and
-     keeps it around as a "zombie".  Somehow, the GNU/Linux Threads
-     library doesn't notice this, which leads to the "zombie problem":
-     When debugged a multi-threaded process that spawns a lot of
-     threads will run out of processes, even if the threads exit,
-     because the "zombies" stay around.  */
-
-/* List of known LWPs.  */
-static struct lwp_info *lwp_list;
-
-/* Number of LWPs in the list.  */
-static int num_lwps;
-
-/* Non-zero if we're running in "threaded" mode.  */
-static int threaded;
-
-
-#define GET_LWP(ptid)		ptid_get_lwp (ptid)
-#define GET_PID(ptid)		ptid_get_pid (ptid)
-#define is_lwp(ptid)		(GET_LWP (ptid) != 0)
-#define BUILD_LWP(lwp, pid)	ptid_build (pid, lwp, 0)
-
-/* If the last reported event was a SIGTRAP, this variable is set to
-   the process id of the LWP/thread that got it.  */
-ptid_t trap_ptid;
-
-
-/* This module's target-specific operations.  */
-static struct target_ops linux_nat_ops;
-
-/* Since we cannot wait (in linux_nat_wait) for the initial process and
-   any cloned processes with a single call to waitpid, we have to use
-   the WNOHANG flag and call waitpid in a loop.  To optimize
-   things a bit we use `sigsuspend' to wake us up when a process has
-   something to report (it will send us a SIGCHLD if it has).  To make
-   this work we have to juggle with the signal mask.  We save the
-   original signal mask such that we can restore it before creating a
-   new process in order to avoid blocking certain signals in the
-   inferior.  We then block SIGCHLD during the waitpid/sigsuspend
-   loop.  */
-
-/* Original signal mask.  */
-static sigset_t normal_mask;
-
-/* Signal mask for use with sigsuspend in linux_nat_wait, initialized in
-   _initialize_linux_nat.  */
-static sigset_t suspend_mask;
-
-/* Signals to block to make that sigsuspend work.  */
-static sigset_t blocked_mask;
-
-
-/* Prototypes for local functions.  */
-static int stop_wait_callback (struct lwp_info *lp, void *data);
-static int linux_nat_thread_alive (ptid_t ptid);
-
-/* Convert wait status STATUS to a string.  Used for printing debug
-   messages only.  */
-
-static char *
-status_to_str (int status)
-{
-  static char buf[64];
-
-  if (WIFSTOPPED (status))
-    snprintf (buf, sizeof (buf), "%s (stopped)",
-	      strsignal (WSTOPSIG (status)));
-  else if (WIFSIGNALED (status))
-    snprintf (buf, sizeof (buf), "%s (terminated)",
-	      strsignal (WSTOPSIG (status)));
-  else
-    snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
-
-  return buf;
-}
-
-/* Initialize the list of LWPs.  Note that this module, contrary to
-   what GDB's generic threads layer does for its thread list,
-   re-initializes the LWP lists whenever we mourn or detach (which
-   doesn't involve mourning) the inferior.  */
-
-static void
-init_lwp_list (void)
-{
-  struct lwp_info *lp, *lpnext;
-
-  for (lp = lwp_list; lp; lp = lpnext)
-    {
-      lpnext = lp->next;
-      xfree (lp);
-    }
-
-  lwp_list = NULL;
-  num_lwps = 0;
-  threaded = 0;
-}
-
-/* Add the LWP specified by PID to the list.  If this causes the
-   number of LWPs to become larger than one, go into "threaded" mode.
-   Return a pointer to the structure describing the new LWP.  */
-
-static struct lwp_info *
-add_lwp (ptid_t ptid)
-{
-  struct lwp_info *lp;
-
-  gdb_assert (is_lwp (ptid));
-
-  lp = (struct lwp_info *) xmalloc (sizeof (struct lwp_info));
-
-  memset (lp, 0, sizeof (struct lwp_info));
-
-  lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
-
-  lp->ptid = ptid;
-
-  lp->next = lwp_list;
-  lwp_list = lp;
-  if (++num_lwps > 1)
-    threaded = 1;
-
-  return lp;
-}
-
-/* Remove the LWP specified by PID from the list.  */
-
-static void
-delete_lwp (ptid_t ptid)
-{
-  struct lwp_info *lp, *lpprev;
-
-  lpprev = NULL;
-
-  for (lp = lwp_list; lp; lpprev = lp, lp = lp->next)
-    if (ptid_equal (lp->ptid, ptid))
-      break;
-
-  if (!lp)
-    return;
-
-  /* We don't go back to "non-threaded" mode if the number of threads
-     becomes less than two.  */
-  num_lwps--;
-
-  if (lpprev)
-    lpprev->next = lp->next;
-  else
-    lwp_list = lp->next;
-
-  xfree (lp);
-}
-
-/* Return a pointer to the structure describing the LWP corresponding
-   to PID.  If no corresponding LWP could be found, return NULL.  */
-
-static struct lwp_info *
-find_lwp_pid (ptid_t ptid)
-{
-  struct lwp_info *lp;
-  int lwp;
-
-  if (is_lwp (ptid))
-    lwp = GET_LWP (ptid);
-  else
-    lwp = GET_PID (ptid);
-
-  for (lp = lwp_list; lp; lp = lp->next)
-    if (lwp == GET_LWP (lp->ptid))
-      return lp;
-
-  return NULL;
-}
-
-/* Call CALLBACK with its second argument set to DATA for every LWP in
-   the list.  If CALLBACK returns 1 for a particular LWP, return a
-   pointer to the structure describing that LWP immediately.
-   Otherwise return NULL.  */
-
-struct lwp_info *
-iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
-{
-  struct lwp_info *lp, *lpnext;
-
-  for (lp = lwp_list; lp; lp = lpnext)
-    {
-      lpnext = lp->next;
-      if ((*callback) (lp, data))
-	return lp;
-    }
-
-  return NULL;
-}
-
-/* Attach to the LWP specified by PID.  If VERBOSE is non-zero, print
-   a message telling the user that a new LWP has been added to the
-   process.  */
-
-void
-lin_lwp_attach_lwp (ptid_t ptid, int verbose)
-{
-  struct lwp_info *lp, *found_lp;
-
-  gdb_assert (is_lwp (ptid));
-
-  /* Make sure SIGCHLD is blocked.  We don't want SIGCHLD events
-     to interrupt either the ptrace() or waitpid() calls below.  */
-  if (!sigismember (&blocked_mask, SIGCHLD))
-    {
-      sigaddset (&blocked_mask, SIGCHLD);
-      sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
-    }
-
-  if (verbose)
-    printf_filtered ("[New %s]\n", target_pid_to_str (ptid));
-
-  found_lp = lp = find_lwp_pid (ptid);
-  if (lp == NULL)
-    lp = add_lwp (ptid);
-
-  /* We assume that we're already attached to any LWP that has an id
-     equal to the overall process id, and to any LWP that is already
-     in our list of LWPs.  If we're not seeing exit events from threads
-     and we've had PID wraparound since we last tried to stop all threads,
-     this assumption might be wrong; fortunately, this is very unlikely
-     to happen.  */
-  if (GET_LWP (ptid) != GET_PID (ptid) && found_lp == NULL)
-    {
-      pid_t pid;
-      int status;
-
-      if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
-	error ("Can't attach %s: %s", target_pid_to_str (ptid),
-	       safe_strerror (errno));
-
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
-			    target_pid_to_str (ptid));
-
-      pid = waitpid (GET_LWP (ptid), &status, 0);
-      if (pid == -1 && errno == ECHILD)
-	{
-	  /* Try again with __WCLONE to check cloned processes.  */
-	  pid = waitpid (GET_LWP (ptid), &status, __WCLONE);
-	  lp->cloned = 1;
-	}
-
-      gdb_assert (pid == GET_LWP (ptid)
-		  && WIFSTOPPED (status) && WSTOPSIG (status));
-
-      child_post_attach (pid);
-
-      lp->stopped = 1;
-
-      if (debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "LLAL: waitpid %s received %s\n",
-			      target_pid_to_str (ptid),
-			      status_to_str (status));
-	}
-    }
-  else
-    {
-      /* We assume that the LWP representing the original process is
-         already stopped.  Mark it as stopped in the data structure
-         that the linux ptrace layer uses to keep track of threads.
-         Note that this won't have already been done since the main
-         thread will have, we assume, been stopped by an attach from a
-         different layer.  */
-      lp->stopped = 1;
-    }
-}
-
-static void
-linux_nat_attach (char *args, int from_tty)
-{
-  struct lwp_info *lp;
-  pid_t pid;
-  int status;
-
-  /* FIXME: We should probably accept a list of process id's, and
-     attach all of them.  */
-  deprecated_child_ops.to_attach (args, from_tty);
-
-  /* Add the initial process as the first LWP to the list.  */
-  lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
-
-  /* Make sure the initial process is stopped.  The user-level threads
-     layer might want to poke around in the inferior, and that won't
-     work if things haven't stabilized yet.  */
-  pid = waitpid (GET_PID (inferior_ptid), &status, 0);
-  if (pid == -1 && errno == ECHILD)
-    {
-      warning ("%s is a cloned process", target_pid_to_str (inferior_ptid));
-
-      /* Try again with __WCLONE to check cloned processes.  */
-      pid = waitpid (GET_PID (inferior_ptid), &status, __WCLONE);
-      lp->cloned = 1;
-    }
-
-  gdb_assert (pid == GET_PID (inferior_ptid)
-	      && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP);
-
-  lp->stopped = 1;
-
-  /* Fake the SIGSTOP that core GDB expects.  */
-  lp->status = W_STOPCODE (SIGSTOP);
-  lp->resumed = 1;
-  if (debug_linux_nat)
-    {
-      fprintf_unfiltered (gdb_stdlog,
-			  "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
-    }
-}
-
-static int
-detach_callback (struct lwp_info *lp, void *data)
-{
-  gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
-
-  if (debug_linux_nat && lp->status)
-    fprintf_unfiltered (gdb_stdlog, "DC:  Pending %s for %s on detach.\n",
-			strsignal (WSTOPSIG (lp->status)),
-			target_pid_to_str (lp->ptid));
-
-  while (lp->signalled && lp->stopped)
-    {
-      errno = 0;
-      if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
-		  WSTOPSIG (lp->status)) < 0)
-	error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
-	       safe_strerror (errno));
-
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "DC:  PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
-			    target_pid_to_str (lp->ptid),
-			    status_to_str (lp->status));
-
-      lp->stopped = 0;
-      lp->signalled = 0;
-      lp->status = 0;
-      /* FIXME drow/2003-08-26: There was a call to stop_wait_callback
-	 here.  But since lp->signalled was cleared above,
-	 stop_wait_callback didn't do anything; the process was left
-	 running.  Shouldn't we be waiting for it to stop?
-	 I've removed the call, since stop_wait_callback now does do
-	 something when called with lp->signalled == 0.  */
-
-      gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
-    }
-
-  /* We don't actually detach from the LWP that has an id equal to the
-     overall process id just yet.  */
-  if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
-    {
-      errno = 0;
-      if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
-		  WSTOPSIG (lp->status)) < 0)
-	error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
-	       safe_strerror (errno));
-
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "PTRACE_DETACH (%s, %s, 0) (OK)\n",
-			    target_pid_to_str (lp->ptid),
-			    strsignal (WSTOPSIG (lp->status)));
-
-      delete_lwp (lp->ptid);
-    }
-
-  return 0;
-}
-
-static void
-linux_nat_detach (char *args, int from_tty)
-{
-  iterate_over_lwps (detach_callback, NULL);
-
-  /* Only the initial process should be left right now.  */
-  gdb_assert (num_lwps == 1);
-
-  trap_ptid = null_ptid;
-
-  /* Destroy LWP info; it's no longer valid.  */
-  init_lwp_list ();
-
-  /* Restore the original signal mask.  */
-  sigprocmask (SIG_SETMASK, &normal_mask, NULL);
-  sigemptyset (&blocked_mask);
-
-  inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
-  deprecated_child_ops.to_detach (args, from_tty);
-}
-
-/* Resume LP.  */
-
-static int
-resume_callback (struct lwp_info *lp, void *data)
-{
-  if (lp->stopped && lp->status == 0)
-    {
-      struct thread_info *tp;
-
-      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "RC:  PTRACE_CONT %s, 0, 0 (resume sibling)\n",
-			    target_pid_to_str (lp->ptid));
-      lp->stopped = 0;
-      lp->step = 0;
-    }
-
-  return 0;
-}
-
-static int
-resume_clear_callback (struct lwp_info *lp, void *data)
-{
-  lp->resumed = 0;
-  return 0;
-}
-
-static int
-resume_set_callback (struct lwp_info *lp, void *data)
-{
-  lp->resumed = 1;
-  return 0;
-}
-
-static void
-linux_nat_resume (ptid_t ptid, int step, enum target_signal signo)
-{
-  struct lwp_info *lp;
-  int resume_all;
-
-  /* A specific PTID means `step only this process id'.  */
-  resume_all = (PIDGET (ptid) == -1);
-
-  if (resume_all)
-    iterate_over_lwps (resume_set_callback, NULL);
-  else
-    iterate_over_lwps (resume_clear_callback, NULL);
-
-  /* If PID is -1, it's the current inferior that should be
-     handled specially.  */
-  if (PIDGET (ptid) == -1)
-    ptid = inferior_ptid;
-
-  lp = find_lwp_pid (ptid);
-  if (lp)
-    {
-      ptid = pid_to_ptid (GET_LWP (lp->ptid));
-
-      /* Remember if we're stepping.  */
-      lp->step = step;
-
-      /* Mark this LWP as resumed.  */
-      lp->resumed = 1;
-
-      /* If we have a pending wait status for this thread, there is no
-         point in resuming the process.  */
-      if (lp->status)
-	{
-	  /* FIXME: What should we do if we are supposed to continue
-	     this thread with a signal?  */
-	  gdb_assert (signo == TARGET_SIGNAL_0);
-	  return;
-	}
-
-      /* Mark LWP as not stopped to prevent it from being continued by
-         resume_callback.  */
-      lp->stopped = 0;
-    }
-
-  if (resume_all)
-    iterate_over_lwps (resume_callback, NULL);
-
-  child_resume (ptid, step, signo);
-  if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog,
-			"LLR: %s %s, %s (resume event thread)\n",
-			step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
-			target_pid_to_str (ptid),
-			signo ? strsignal (signo) : "0");
-}
-
-/* Issue kill to specified lwp.  */
-
-static int tkill_failed;
-
-static int
-kill_lwp (int lwpid, int signo)
-{
-  errno = 0;
-
-/* Use tkill, if possible, in case we are using nptl threads.  If tkill
-   fails, then we are not using nptl threads and we should be using kill.  */
-
-#ifdef HAVE_TKILL_SYSCALL
-  if (!tkill_failed)
-    {
-      int ret = syscall (__NR_tkill, lwpid, signo);
-      if (errno != ENOSYS)
-	return ret;
-      errno = 0;
-      tkill_failed = 1;
-    }
-#endif
-
-  return kill (lwpid, signo);
-}
-
-/* Handle a GNU/Linux extended wait response.  Most of the work we
-   just pass off to linux_handle_extended_wait, but if it reports a
-   clone event we need to add the new LWP to our list (and not report
-   the trap to higher layers).  This function returns non-zero if
-   the event should be ignored and we should wait again.  */
-
-static int
-linux_nat_handle_extended (struct lwp_info *lp, int status)
-{
-  linux_handle_extended_wait (GET_LWP (lp->ptid), status,
-			      &lp->waitstatus);
-
-  /* TARGET_WAITKIND_SPURIOUS is used to indicate clone events.  */
-  if (lp->waitstatus.kind == TARGET_WAITKIND_SPURIOUS)
-    {
-      struct lwp_info *new_lp;
-      new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid,
-				   GET_PID (inferior_ptid)));
-      new_lp->cloned = 1;
-      new_lp->stopped = 1;
-
-      lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
-
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLHE: Got clone event from LWP %ld, resuming\n",
-			    GET_LWP (lp->ptid));
-      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-
-      return 1;
-    }
-
-  return 0;
-}
-
-/* Wait for LP to stop.  Returns the wait status, or 0 if the LWP has
-   exited.  */
-
-static int
-wait_lwp (struct lwp_info *lp)
-{
-  pid_t pid;
-  int status;
-  int thread_dead = 0;
-
-  gdb_assert (!lp->stopped);
-  gdb_assert (lp->status == 0);
-
-  pid = waitpid (GET_LWP (lp->ptid), &status, 0);
-  if (pid == -1 && errno == ECHILD)
-    {
-      pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
-      if (pid == -1 && errno == ECHILD)
-	{
-	  /* The thread has previously exited.  We need to delete it
-	     now because, for some vendor 2.4 kernels with NPTL
-	     support backported, there won't be an exit event unless
-	     it is the main thread.  2.6 kernels will report an exit
-	     event for each thread that exits, as expected.  */
-	  thread_dead = 1;
-	  if (debug_linux_nat)
-	    fprintf_unfiltered (gdb_stdlog, "WL: %s vanished.\n",
-				target_pid_to_str (lp->ptid));
-	}
-    }
-
-  if (!thread_dead)
-    {
-      gdb_assert (pid == GET_LWP (lp->ptid));
-
-      if (debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "WL: waitpid %s received %s\n",
-			      target_pid_to_str (lp->ptid),
-			      status_to_str (status));
-	}
-    }
-
-  /* Check if the thread has exited.  */
-  if (WIFEXITED (status) || WIFSIGNALED (status))
-    {
-      thread_dead = 1;
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog, "WL: %s exited.\n",
-			    target_pid_to_str (lp->ptid));
-    }
-
-  if (thread_dead)
-    {
-      if (in_thread_list (lp->ptid))
-	{
-	  /* Core GDB cannot deal with us deleting the current thread.  */
-	  if (!ptid_equal (lp->ptid, inferior_ptid))
-	    delete_thread (lp->ptid);
-	  printf_unfiltered ("[%s exited]\n",
-			     target_pid_to_str (lp->ptid));
-	}
-
-      delete_lwp (lp->ptid);
-      return 0;
-    }
-
-  gdb_assert (WIFSTOPPED (status));
-
-  /* Handle GNU/Linux's extended waitstatus for trace events.  */
-  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
-    {
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "WL: Handling extended status 0x%06x\n",
-			    status);
-      if (linux_nat_handle_extended (lp, status))
-	return wait_lwp (lp);
-    }
-
-  return status;
-}
-
-/* Send a SIGSTOP to LP.  */
-
-static int
-stop_callback (struct lwp_info *lp, void *data)
-{
-  if (!lp->stopped && !lp->signalled)
-    {
-      int ret;
-
-      if (debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "SC:  kill %s **<SIGSTOP>**\n",
-			      target_pid_to_str (lp->ptid));
-	}
-      errno = 0;
-      ret = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
-      if (debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "SC:  lwp kill %d %s\n",
-			      ret,
-			      errno ? safe_strerror (errno) : "ERRNO-OK");
-	}
-
-      lp->signalled = 1;
-      gdb_assert (lp->status == 0);
-    }
-
-  return 0;
-}
-
-/* Wait until LP is stopped.  If DATA is non-null it is interpreted as
-   a pointer to a set of signals to be flushed immediately.  */
-
-static int
-stop_wait_callback (struct lwp_info *lp, void *data)
-{
-  sigset_t *flush_mask = data;
-
-  if (!lp->stopped)
-    {
-      int status;
-
-      status = wait_lwp (lp);
-      if (status == 0)
-	return 0;
-
-      /* Ignore any signals in FLUSH_MASK.  */
-      if (flush_mask && sigismember (flush_mask, WSTOPSIG (status)))
-	{
-	  if (!lp->signalled)
-	    {
-	      lp->stopped = 1;
-	      return 0;
-	    }
-
-	  errno = 0;
-	  ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-	  if (debug_linux_nat)
-	    fprintf_unfiltered (gdb_stdlog,
-				"PTRACE_CONT %s, 0, 0 (%s)\n",
-				target_pid_to_str (lp->ptid),
-				errno ? safe_strerror (errno) : "OK");
-
-	  return stop_wait_callback (lp, flush_mask);
-	}
-
-      if (WSTOPSIG (status) != SIGSTOP)
-	{
-	  if (WSTOPSIG (status) == SIGTRAP)
-	    {
-	      /* If a LWP other than the LWP that we're reporting an
-	         event for has hit a GDB breakpoint (as opposed to
-	         some random trap signal), then just arrange for it to
-	         hit it again later.  We don't keep the SIGTRAP status
-	         and don't forward the SIGTRAP signal to the LWP.  We
-	         will handle the current event, eventually we will
-	         resume all LWPs, and this one will get its breakpoint
-	         trap again.
-
-	         If we do not do this, then we run the risk that the
-	         user will delete or disable the breakpoint, but the
-	         thread will have already tripped on it.  */
-
-	      /* Now resume this LWP and get the SIGSTOP event. */
-	      errno = 0;
-	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-	      if (debug_linux_nat)
-		{
-		  fprintf_unfiltered (gdb_stdlog,
-				      "PTRACE_CONT %s, 0, 0 (%s)\n",
-				      target_pid_to_str (lp->ptid),
-				      errno ? safe_strerror (errno) : "OK");
-
-		  fprintf_unfiltered (gdb_stdlog,
-				      "SWC: Candidate SIGTRAP event in %s\n",
-				      target_pid_to_str (lp->ptid));
-		}
-	      /* Hold the SIGTRAP for handling by linux_nat_wait. */
-	      stop_wait_callback (lp, data);
-	      /* If there's another event, throw it back into the queue. */
-	      if (lp->status)
-		{
-		  if (debug_linux_nat)
-		    {
-		      fprintf_unfiltered (gdb_stdlog,
-					  "SWC: kill %s, %s\n",
-					  target_pid_to_str (lp->ptid),
-					  status_to_str ((int) status));
-		    }
-		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
-		}
-	      /* Save the sigtrap event. */
-	      lp->status = status;
-	      return 0;
-	    }
-	  else
-	    {
-	      /* The thread was stopped with a signal other than
-	         SIGSTOP, and didn't accidentally trip a breakpoint. */
-
-	      if (debug_linux_nat)
-		{
-		  fprintf_unfiltered (gdb_stdlog,
-				      "SWC: Pending event %s in %s\n",
-				      status_to_str ((int) status),
-				      target_pid_to_str (lp->ptid));
-		}
-	      /* Now resume this LWP and get the SIGSTOP event. */
-	      errno = 0;
-	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
-				    target_pid_to_str (lp->ptid),
-				    errno ? safe_strerror (errno) : "OK");
-
-	      /* Hold this event/waitstatus while we check to see if
-	         there are any more (we still want to get that SIGSTOP). */
-	      stop_wait_callback (lp, data);
-	      /* If the lp->status field is still empty, use it to hold
-	         this event.  If not, then this event must be returned
-	         to the event queue of the LWP.  */
-	      if (lp->status == 0)
-		lp->status = status;
-	      else
-		{
-		  if (debug_linux_nat)
-		    {
-		      fprintf_unfiltered (gdb_stdlog,
-					  "SWC: kill %s, %s\n",
-					  target_pid_to_str (lp->ptid),
-					  status_to_str ((int) status));
-		    }
-		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
-		}
-	      return 0;
-	    }
-	}
-      else
-	{
-	  /* We caught the SIGSTOP that we intended to catch, so
-	     there's no SIGSTOP pending.  */
-	  lp->stopped = 1;
-	  lp->signalled = 0;
-	}
-    }
-
-  return 0;
-}
-
-/* Check whether PID has any pending signals in FLUSH_MASK.  If so set
-   the appropriate bits in PENDING, and return 1 - otherwise return 0.  */
-
-static int
-linux_nat_has_pending (int pid, sigset_t *pending, sigset_t *flush_mask)
-{
-  sigset_t blocked, ignored;
-  int i;
-
-  linux_proc_pending_signals (pid, pending, &blocked, &ignored);
-
-  if (!flush_mask)
-    return 0;
-
-  for (i = 1; i < NSIG; i++)
-    if (sigismember (pending, i))
-      if (!sigismember (flush_mask, i)
-	  || sigismember (&blocked, i)
-	  || sigismember (&ignored, i))
-	sigdelset (pending, i);
-
-  if (sigisemptyset (pending))
-    return 0;
-
-  return 1;
-}
-
-/* DATA is interpreted as a mask of signals to flush.  If LP has
-   signals pending, and they are all in the flush mask, then arrange
-   to flush them.  LP should be stopped, as should all other threads
-   it might share a signal queue with.  */
-
-static int
-flush_callback (struct lwp_info *lp, void *data)
-{
-  sigset_t *flush_mask = data;
-  sigset_t pending, intersection, blocked, ignored;
-  int pid, status;
-
-  /* Normally, when an LWP exits, it is removed from the LWP list.  The
-     last LWP isn't removed till later, however.  So if there is only
-     one LWP on the list, make sure it's alive.  */
-  if (lwp_list == lp && lp->next == NULL)
-    if (!linux_nat_thread_alive (lp->ptid))
-      return 0;
-
-  /* Just because the LWP is stopped doesn't mean that new signals
-     can't arrive from outside, so this function must be careful of
-     race conditions.  However, because all threads are stopped, we
-     can assume that the pending mask will not shrink unless we resume
-     the LWP, and that it will then get another signal.  We can't
-     control which one, however.  */
-
-  if (lp->status)
-    {
-      if (debug_linux_nat)
-	printf_unfiltered ("FC: LP has pending status %06x\n", lp->status);
-      if (WIFSTOPPED (lp->status) && sigismember (flush_mask, WSTOPSIG (lp->status)))
-	lp->status = 0;
-    }
-
-  while (linux_nat_has_pending (GET_LWP (lp->ptid), &pending, flush_mask))
-    {
-      int ret;
-      
-      errno = 0;
-      ret = ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stderr,
-			    "FC: Sent PTRACE_CONT, ret %d %d\n", ret, errno);
-
-      lp->stopped = 0;
-      stop_wait_callback (lp, flush_mask);
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stderr,
-			    "FC: Wait finished; saved status is %d\n",
-			    lp->status);
-    }
-
-  return 0;
-}
-
-/* Return non-zero if LP has a wait status pending.  */
-
-static int
-status_callback (struct lwp_info *lp, void *data)
-{
-  /* Only report a pending wait status if we pretend that this has
-     indeed been resumed.  */
-  return (lp->status != 0 && lp->resumed);
-}
-
-/* Return non-zero if LP isn't stopped.  */
-
-static int
-running_callback (struct lwp_info *lp, void *data)
-{
-  return (lp->stopped == 0 || (lp->status != 0 && lp->resumed));
-}
-
-/* Count the LWP's that have had events.  */
-
-static int
-count_events_callback (struct lwp_info *lp, void *data)
-{
-  int *count = data;
-
-  gdb_assert (count != NULL);
-
-  /* Count only LWPs that have a SIGTRAP event pending.  */
-  if (lp->status != 0
-      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
-    (*count)++;
-
-  return 0;
-}
-
-/* Select the LWP (if any) that is currently being single-stepped.  */
-
-static int
-select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
-{
-  if (lp->step && lp->status != 0)
-    return 1;
-  else
-    return 0;
-}
-
-/* Select the Nth LWP that has had a SIGTRAP event.  */
-
-static int
-select_event_lwp_callback (struct lwp_info *lp, void *data)
-{
-  int *selector = data;
-
-  gdb_assert (selector != NULL);
-
-  /* Select only LWPs that have a SIGTRAP event pending. */
-  if (lp->status != 0
-      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
-    if ((*selector)-- == 0)
-      return 1;
-
-  return 0;
-}
-
-static int
-cancel_breakpoints_callback (struct lwp_info *lp, void *data)
-{
-  struct lwp_info *event_lp = data;
-
-  /* Leave the LWP that has been elected to receive a SIGTRAP alone.  */
-  if (lp == event_lp)
-    return 0;
-
-  /* If a LWP other than the LWP that we're reporting an event for has
-     hit a GDB breakpoint (as opposed to some random trap signal),
-     then just arrange for it to hit it again later.  We don't keep
-     the SIGTRAP status and don't forward the SIGTRAP signal to the
-     LWP.  We will handle the current event, eventually we will resume
-     all LWPs, and this one will get its breakpoint trap again.
-
-     If we do not do this, then we run the risk that the user will
-     delete or disable the breakpoint, but the LWP will have already
-     tripped on it.  */
-
-  if (lp->status != 0
-      && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
-      && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
-				     DECR_PC_AFTER_BREAK))
-    {
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "CBC: Push back breakpoint for %s\n",
-			    target_pid_to_str (lp->ptid));
-
-      /* Back up the PC if necessary.  */
-      if (DECR_PC_AFTER_BREAK)
-	write_pc_pid (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK, lp->ptid);
-
-      /* Throw away the SIGTRAP.  */
-      lp->status = 0;
-    }
-
-  return 0;
-}
-
-/* Select one LWP out of those that have events pending.  */
-
-static void
-select_event_lwp (struct lwp_info **orig_lp, int *status)
-{
-  int num_events = 0;
-  int random_selector;
-  struct lwp_info *event_lp;
-
-  /* Record the wait status for the origional LWP.  */
-  (*orig_lp)->status = *status;
-
-  /* Give preference to any LWP that is being single-stepped.  */
-  event_lp = iterate_over_lwps (select_singlestep_lwp_callback, NULL);
-  if (event_lp != NULL)
-    {
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "SEL: Select single-step %s\n",
-			    target_pid_to_str (event_lp->ptid));
-    }
-  else
-    {
-      /* No single-stepping LWP.  Select one at random, out of those
-         which have had SIGTRAP events.  */
-
-      /* First see how many SIGTRAP events we have.  */
-      iterate_over_lwps (count_events_callback, &num_events);
-
-      /* Now randomly pick a LWP out of those that have had a SIGTRAP.  */
-      random_selector = (int)
-	((num_events * (double) rand ()) / (RAND_MAX + 1.0));
-
-      if (debug_linux_nat && num_events > 1)
-	fprintf_unfiltered (gdb_stdlog,
-			    "SEL: Found %d SIGTRAP events, selecting #%d\n",
-			    num_events, random_selector);
-
-      event_lp = iterate_over_lwps (select_event_lwp_callback,
-				    &random_selector);
-    }
-
-  if (event_lp != NULL)
-    {
-      /* Switch the event LWP.  */
-      *orig_lp = event_lp;
-      *status = event_lp->status;
-    }
-
-  /* Flush the wait status for the event LWP.  */
-  (*orig_lp)->status = 0;
-}
-
-/* Return non-zero if LP has been resumed.  */
-
-static int
-resumed_callback (struct lwp_info *lp, void *data)
-{
-  return lp->resumed;
-}
-
-#ifdef CHILD_WAIT
-
-/* We need to override child_wait to support attaching to cloned
-   processes, since a normal wait (as done by the default version)
-   ignores those processes.  */
-
-/* Wait for child PTID to do something.  Return id of the child,
-   minus_one_ptid in case of error; store status into *OURSTATUS.  */
-
-ptid_t
-child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
-  int save_errno;
-  int status;
-  pid_t pid;
-
-  ourstatus->kind = TARGET_WAITKIND_IGNORE;
-
-  do
-    {
-      set_sigint_trap ();	/* Causes SIGINT to be passed on to the
-				   attached process.  */
-      set_sigio_trap ();
-
-      pid = waitpid (GET_PID (ptid), &status, 0);
-      if (pid == -1 && errno == ECHILD)
-	/* Try again with __WCLONE to check cloned processes.  */
-	pid = waitpid (GET_PID (ptid), &status, __WCLONE);
-
-      if (debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "CW:  waitpid %ld received %s\n",
-			      (long) pid, status_to_str (status));
-	}
-
-      save_errno = errno;
-
-      /* Make sure we don't report an event for the exit of the
-         original program, if we've detached from it.  */
-      if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
-	{
-	  pid = -1;
-	  save_errno = EINTR;
-	}
-
-      /* Check for stop events reported by a process we didn't already
-	 know about - in this case, anything other than inferior_ptid.
-
-	 If we're expecting to receive stopped processes after fork,
-	 vfork, and clone events, then we'll just add the new one to
-	 our list and go back to waiting for the event to be reported
-	 - the stopped process might be returned from waitpid before
-	 or after the event is.  If we want to handle debugging of
-	 CLONE_PTRACE processes we need to do more here, i.e. switch
-	 to multi-threaded mode.  */
-      if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP
-	  && pid != GET_PID (inferior_ptid))
-	{
-	  linux_record_stopped_pid (pid);
-	  pid = -1;
-	  save_errno = EINTR;
-	}
-
-      /* Handle GNU/Linux's extended waitstatus for trace events.  */
-      if (pid != -1 && WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP
-	  && status >> 16 != 0)
-	{
-	  linux_handle_extended_wait (pid, status, ourstatus);
-
-	  /* If we see a clone event, detach the child, and don't
-	     report the event.  It would be nice to offer some way to
-	     switch into a non-thread-db based threaded mode at this
-	     point.  */
-	  if (ourstatus->kind == TARGET_WAITKIND_SPURIOUS)
-	    {
-	      ptrace (PTRACE_DETACH, ourstatus->value.related_pid, 0, 0);
-	      ourstatus->kind = TARGET_WAITKIND_IGNORE;
-	      ptrace (PTRACE_CONT, pid, 0, 0);
-	      pid = -1;
-	      save_errno = EINTR;
-	    }
-	}
-
-      clear_sigio_trap ();
-      clear_sigint_trap ();
-    }
-  while (pid == -1 && save_errno == EINTR);
-
-  if (pid == -1)
-    {
-      warning ("Child process unexpectedly missing: %s",
-	       safe_strerror (errno));
-
-      /* Claim it exited with unknown signal.  */
-      ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
-      ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
-      return minus_one_ptid;
-    }
-
-  if (ourstatus->kind == TARGET_WAITKIND_IGNORE)
-    store_waitstatus (ourstatus, status);
-
-  return pid_to_ptid (pid);
-}
-
-#endif
-
-/* Stop an active thread, verify it still exists, then resume it.  */
-
-static int
-stop_and_resume_callback (struct lwp_info *lp, void *data)
-{
-  struct lwp_info *ptr;
-
-  if (!lp->stopped && !lp->signalled)
-    {
-      stop_callback (lp, NULL);
-      stop_wait_callback (lp, NULL);
-      /* Resume if the lwp still exists.  */
-      for (ptr = lwp_list; ptr; ptr = ptr->next)
-	if (lp == ptr)
-	  {
-	    resume_callback (lp, NULL);
-	    resume_set_callback (lp, NULL);
-	  }
-    }
-  return 0;
-}
-
-static ptid_t
-linux_nat_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
-  struct lwp_info *lp = NULL;
-  int options = 0;
-  int status = 0;
-  pid_t pid = PIDGET (ptid);
-  sigset_t flush_mask;
-
-  sigemptyset (&flush_mask);
-
-  /* Make sure SIGCHLD is blocked.  */
-  if (!sigismember (&blocked_mask, SIGCHLD))
-    {
-      sigaddset (&blocked_mask, SIGCHLD);
-      sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
-    }
-
-retry:
-
-  /* Make sure there is at least one LWP that has been resumed, at
-     least if there are any LWPs at all.  */
-  gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL));
-
-  /* First check if there is a LWP with a wait status pending.  */
-  if (pid == -1)
-    {
-      /* Any LWP that's been resumed will do.  */
-      lp = iterate_over_lwps (status_callback, NULL);
-      if (lp)
-	{
-	  status = lp->status;
-	  lp->status = 0;
-
-	  if (debug_linux_nat && status)
-	    fprintf_unfiltered (gdb_stdlog,
-				"LLW: Using pending wait status %s for %s.\n",
-				status_to_str (status),
-				target_pid_to_str (lp->ptid));
-	}
-
-      /* But if we don't fine one, we'll have to wait, and check both
-         cloned and uncloned processes.  We start with the cloned
-         processes.  */
-      options = __WCLONE | WNOHANG;
-    }
-  else if (is_lwp (ptid))
-    {
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLW: Waiting for specific LWP %s.\n",
-			    target_pid_to_str (ptid));
-
-      /* We have a specific LWP to check.  */
-      lp = find_lwp_pid (ptid);
-      gdb_assert (lp);
-      status = lp->status;
-      lp->status = 0;
-
-      if (debug_linux_nat && status)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLW: Using pending wait status %s for %s.\n",
-			    status_to_str (status),
-			    target_pid_to_str (lp->ptid));
-
-      /* If we have to wait, take into account whether PID is a cloned
-         process or not.  And we have to convert it to something that
-         the layer beneath us can understand.  */
-      options = lp->cloned ? __WCLONE : 0;
-      pid = GET_LWP (ptid);
-    }
-
-  if (status && lp->signalled)
-    {
-      /* A pending SIGSTOP may interfere with the normal stream of
-         events.  In a typical case where interference is a problem,
-         we have a SIGSTOP signal pending for LWP A while
-         single-stepping it, encounter an event in LWP B, and take the
-         pending SIGSTOP while trying to stop LWP A.  After processing
-         the event in LWP B, LWP A is continued, and we'll never see
-         the SIGTRAP associated with the last time we were
-         single-stepping LWP A.  */
-
-      /* Resume the thread.  It should halt immediately returning the
-         pending SIGSTOP.  */
-      registers_changed ();
-      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
-		    TARGET_SIGNAL_0);
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
-			    lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
-			    target_pid_to_str (lp->ptid));
-      lp->stopped = 0;
-      gdb_assert (lp->resumed);
-
-      /* This should catch the pending SIGSTOP.  */
-      stop_wait_callback (lp, NULL);
-    }
-
-  set_sigint_trap ();		/* Causes SIGINT to be passed on to the
-				   attached process. */
-  set_sigio_trap ();
-
-  while (status == 0)
-    {
-      pid_t lwpid;
-
-      lwpid = waitpid (pid, &status, options);
-      if (lwpid > 0)
-	{
-	  gdb_assert (pid == -1 || lwpid == pid);
-
-	  if (debug_linux_nat)
-	    {
-	      fprintf_unfiltered (gdb_stdlog,
-				  "LLW: waitpid %ld received %s\n",
-				  (long) lwpid, status_to_str (status));
-	    }
-
-	  lp = find_lwp_pid (pid_to_ptid (lwpid));
-
-	  /* Check for stop events reported by a process we didn't
-	     already know about - anything not already in our LWP
-	     list.
-
-	     If we're expecting to receive stopped processes after
-	     fork, vfork, and clone events, then we'll just add the
-	     new one to our list and go back to waiting for the event
-	     to be reported - the stopped process might be returned
-	     from waitpid before or after the event is.  */
-	  if (WIFSTOPPED (status) && !lp)
-	    {
-	      linux_record_stopped_pid (lwpid);
-	      status = 0;
-	      continue;
-	    }
-
-	  /* Make sure we don't report an event for the exit of an LWP not in
-	     our list, i.e.  not part of the current process.  This can happen
-	     if we detach from a program we original forked and then it
-	     exits.  */
-	  if (!WIFSTOPPED (status) && !lp)
-	    {
-	      status = 0;
-	      continue;
-	    }
-
-	  /* NOTE drow/2003-06-17: This code seems to be meant for debugging
-	     CLONE_PTRACE processes which do not use the thread library -
-	     otherwise we wouldn't find the new LWP this way.  That doesn't
-	     currently work, and the following code is currently unreachable
-	     due to the two blocks above.  If it's fixed some day, this code
-	     should be broken out into a function so that we can also pick up
-	     LWPs from the new interface.  */
-	  if (!lp)
-	    {
-	      lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
-	      if (options & __WCLONE)
-		lp->cloned = 1;
-
-	      if (threaded)
-		{
-		  gdb_assert (WIFSTOPPED (status)
-			      && WSTOPSIG (status) == SIGSTOP);
-		  lp->signalled = 1;
-
-		  if (!in_thread_list (inferior_ptid))
-		    {
-		      inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
-						 GET_PID (inferior_ptid));
-		      add_thread (inferior_ptid);
-		    }
-
-		  add_thread (lp->ptid);
-		  printf_unfiltered ("[New %s]\n",
-				     target_pid_to_str (lp->ptid));
-		}
-	    }
-
-	  /* Handle GNU/Linux's extended waitstatus for trace events.  */
-	  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP && status >> 16 != 0)
-	    {
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "LLW: Handling extended status 0x%06x\n",
-				    status);
-	      if (linux_nat_handle_extended (lp, status))
-		{
-		  status = 0;
-		  continue;
-		}
-	    }
-
-	  /* Check if the thread has exited.  */
-	  if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
-	    {
-	      if (in_thread_list (lp->ptid))
-		{
-		  /* Core GDB cannot deal with us deleting the current
-		     thread.  */
-		  if (!ptid_equal (lp->ptid, inferior_ptid))
-		    delete_thread (lp->ptid);
-		  printf_unfiltered ("[%s exited]\n",
-				     target_pid_to_str (lp->ptid));
-		}
-
-	      /* If this is the main thread, we must stop all threads and
-	         verify if they are still alive.  This is because in the nptl
-	         thread model, there is no signal issued for exiting LWPs
-	         other than the main thread.  We only get the main thread
-	         exit signal once all child threads have already exited.
-	         If we stop all the threads and use the stop_wait_callback
-	         to check if they have exited we can determine whether this
-	         signal should be ignored or whether it means the end of the
-	         debugged application, regardless of which threading model
-	         is being used.  */
-	      if (GET_PID (lp->ptid) == GET_LWP (lp->ptid))
-		{
-		  lp->stopped = 1;
-		  iterate_over_lwps (stop_and_resume_callback, NULL);
-		}
-
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "LLW: %s exited.\n",
-				    target_pid_to_str (lp->ptid));
-
-	      delete_lwp (lp->ptid);
-
-	      /* If there is at least one more LWP, then the exit signal
-	         was not the end of the debugged application and should be
-	         ignored.  */
-	      if (num_lwps > 0)
-		{
-		  /* Make sure there is at least one thread running.  */
-		  gdb_assert (iterate_over_lwps (running_callback, NULL));
-
-		  /* Discard the event.  */
-		  status = 0;
-		  continue;
-		}
-	    }
-
-	  /* Check if the current LWP has previously exited.  In the nptl
-	     thread model, LWPs other than the main thread do not issue
-	     signals when they exit so we must check whenever the thread
-	     has stopped.  A similar check is made in stop_wait_callback().  */
-	  if (num_lwps > 1 && !linux_nat_thread_alive (lp->ptid))
-	    {
-	      if (in_thread_list (lp->ptid))
-		{
-		  /* Core GDB cannot deal with us deleting the current
-		     thread.  */
-		  if (!ptid_equal (lp->ptid, inferior_ptid))
-		    delete_thread (lp->ptid);
-		  printf_unfiltered ("[%s exited]\n",
-				     target_pid_to_str (lp->ptid));
-		}
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "LLW: %s exited.\n",
-				    target_pid_to_str (lp->ptid));
-
-	      delete_lwp (lp->ptid);
-
-	      /* Make sure there is at least one thread running.  */
-	      gdb_assert (iterate_over_lwps (running_callback, NULL));
-
-	      /* Discard the event.  */
-	      status = 0;
-	      continue;
-	    }
-
-	  /* Make sure we don't report a SIGSTOP that we sent
-	     ourselves in an attempt to stop an LWP.  */
-	  if (lp->signalled
-	      && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
-	    {
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "LLW: Delayed SIGSTOP caught for %s.\n",
-				    target_pid_to_str (lp->ptid));
-
-	      /* This is a delayed SIGSTOP.  */
-	      lp->signalled = 0;
-
-	      registers_changed ();
-	      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
-			    TARGET_SIGNAL_0);
-	      if (debug_linux_nat)
-		fprintf_unfiltered (gdb_stdlog,
-				    "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
-				    lp->step ?
-				    "PTRACE_SINGLESTEP" : "PTRACE_CONT",
-				    target_pid_to_str (lp->ptid));
-
-	      lp->stopped = 0;
-	      gdb_assert (lp->resumed);
-
-	      /* Discard the event.  */
-	      status = 0;
-	      continue;
-	    }
-
-	  break;
-	}
-
-      if (pid == -1)
-	{
-	  /* Alternate between checking cloned and uncloned processes.  */
-	  options ^= __WCLONE;
-
-	  /* And suspend every time we have checked both.  */
-	  if (options & __WCLONE)
-	    sigsuspend (&suspend_mask);
-	}
-
-      /* We shouldn't end up here unless we want to try again.  */
-      gdb_assert (status == 0);
-    }
-
-  clear_sigio_trap ();
-  clear_sigint_trap ();
-
-  gdb_assert (lp);
-
-  /* Don't report signals that GDB isn't interested in, such as
-     signals that are neither printed nor stopped upon.  Stopping all
-     threads can be a bit time-consuming so if we want decent
-     performance with heavily multi-threaded programs, especially when
-     they're using a high frequency timer, we'd better avoid it if we
-     can.  */
-
-  if (WIFSTOPPED (status))
-    {
-      int signo = target_signal_from_host (WSTOPSIG (status));
-
-      if (signal_stop_state (signo) == 0
-	  && signal_print_state (signo) == 0
-	  && signal_pass_state (signo) == 1)
-	{
-	  /* FIMXE: kettenis/2001-06-06: Should we resume all threads
-	     here?  It is not clear we should.  GDB may not expect
-	     other threads to run.  On the other hand, not resuming
-	     newly attached threads may cause an unwanted delay in
-	     getting them running.  */
-	  registers_changed ();
-	  child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
-	  if (debug_linux_nat)
-	    fprintf_unfiltered (gdb_stdlog,
-				"LLW: %s %s, %s (preempt 'handle')\n",
-				lp->step ?
-				"PTRACE_SINGLESTEP" : "PTRACE_CONT",
-				target_pid_to_str (lp->ptid),
-				signo ? strsignal (signo) : "0");
-	  lp->stopped = 0;
-	  status = 0;
-	  goto retry;
-	}
-
-      if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
-	{
-	  /* If ^C/BREAK is typed at the tty/console, SIGINT gets
-	     forwarded to the entire process group, that is, all LWP's
-	     will receive it.  Since we only want to report it once,
-	     we try to flush it from all LWPs except this one.  */
-	  sigaddset (&flush_mask, SIGINT);
-	}
-    }
-
-  /* This LWP is stopped now.  */
-  lp->stopped = 1;
-
-  if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
-			status_to_str (status), target_pid_to_str (lp->ptid));
-
-  /* Now stop all other LWP's ...  */
-  iterate_over_lwps (stop_callback, NULL);
-
-  /* ... and wait until all of them have reported back that they're no
-     longer running.  */
-  iterate_over_lwps (stop_wait_callback, &flush_mask);
-  iterate_over_lwps (flush_callback, &flush_mask);
-
-  /* If we're not waiting for a specific LWP, choose an event LWP from
-     among those that have had events.  Giving equal priority to all
-     LWPs that have had events helps prevent starvation.  */
-  if (pid == -1)
-    select_event_lwp (&lp, &status);
-
-  /* Now that we've selected our final event LWP, cancel any
-     breakpoints in other LWPs that have hit a GDB breakpoint.  See
-     the comment in cancel_breakpoints_callback to find out why.  */
-  iterate_over_lwps (cancel_breakpoints_callback, lp);
-
-  /* If we're not running in "threaded" mode, we'll report the bare
-     process id.  */
-
-  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
-    {
-      trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LLW: trap_ptid is %s.\n",
-			    target_pid_to_str (trap_ptid));
-    }
-  else
-    trap_ptid = null_ptid;
-
-  if (lp->waitstatus.kind != TARGET_WAITKIND_IGNORE)
-    {
-      *ourstatus = lp->waitstatus;
-      lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
-    }
-  else
-    store_waitstatus (ourstatus, status);
-
-  return (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
-}
-
-static int
-kill_callback (struct lwp_info *lp, void *data)
-{
-  errno = 0;
-  ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
-  if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog,
-			"KC:  PTRACE_KILL %s, 0, 0 (%s)\n",
-			target_pid_to_str (lp->ptid),
-			errno ? safe_strerror (errno) : "OK");
-
-  return 0;
-}
-
-static int
-kill_wait_callback (struct lwp_info *lp, void *data)
-{
-  pid_t pid;
-
-  /* We must make sure that there are no pending events (delayed
-     SIGSTOPs, pending SIGTRAPs, etc.) to make sure the current
-     program doesn't interfere with any following debugging session.  */
-
-  /* For cloned processes we must check both with __WCLONE and
-     without, since the exit status of a cloned process isn't reported
-     with __WCLONE.  */
-  if (lp->cloned)
-    {
-      do
-	{
-	  pid = waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
-	  if (pid != (pid_t) -1 && debug_linux_nat)
-	    {
-	      fprintf_unfiltered (gdb_stdlog,
-				  "KWC: wait %s received unknown.\n",
-				  target_pid_to_str (lp->ptid));
-	    }
-	}
-      while (pid == GET_LWP (lp->ptid));
-
-      gdb_assert (pid == -1 && errno == ECHILD);
-    }
-
-  do
-    {
-      pid = waitpid (GET_LWP (lp->ptid), NULL, 0);
-      if (pid != (pid_t) -1 && debug_linux_nat)
-	{
-	  fprintf_unfiltered (gdb_stdlog,
-			      "KWC: wait %s received unk.\n",
-			      target_pid_to_str (lp->ptid));
-	}
-    }
-  while (pid == GET_LWP (lp->ptid));
-
-  gdb_assert (pid == -1 && errno == ECHILD);
-  return 0;
-}
-
-static void
-linux_nat_kill (void)
-{
-  /* Kill all LWP's ...  */
-  iterate_over_lwps (kill_callback, NULL);
-
-  /* ... and wait until we've flushed all events.  */
-  iterate_over_lwps (kill_wait_callback, NULL);
-
-  target_mourn_inferior ();
-}
-
-static void
-linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
-			 int from_tty)
-{
-  deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
-}
-
-static void
-linux_nat_mourn_inferior (void)
-{
-  trap_ptid = null_ptid;
-
-  /* Destroy LWP info; it's no longer valid.  */
-  init_lwp_list ();
-
-  /* Restore the original signal mask.  */
-  sigprocmask (SIG_SETMASK, &normal_mask, NULL);
-  sigemptyset (&blocked_mask);
-
-  deprecated_child_ops.to_mourn_inferior ();
-}
-
-static int
-linux_nat_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		     struct mem_attrib *attrib, struct target_ops *target)
-{
-  struct cleanup *old_chain = save_inferior_ptid ();
-  int xfer;
-
-  if (is_lwp (inferior_ptid))
-    inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
-
-  xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
-  if (xfer == 0)
-    xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
-
-  do_cleanups (old_chain);
-  return xfer;
-}
-
-static int
-linux_nat_thread_alive (ptid_t ptid)
-{
-  gdb_assert (is_lwp (ptid));
-
-  errno = 0;
-  ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
-  if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog,
-			"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
-			target_pid_to_str (ptid),
-			errno ? safe_strerror (errno) : "OK");
-  if (errno)
-    return 0;
-
-  return 1;
-}
-
-static char *
-linux_nat_pid_to_str (ptid_t ptid)
-{
-  static char buf[64];
-
-  if (is_lwp (ptid))
-    {
-      snprintf (buf, sizeof (buf), "LWP %ld", GET_LWP (ptid));
-      return buf;
-    }
-
-  return normal_pid_to_str (ptid);
-}
-
-static void
-init_linux_nat_ops (void)
-{
-#if 0
-  linux_nat_ops.to_open = linux_nat_open;
-#endif
-  linux_nat_ops.to_shortname = "lwp-layer";
-  linux_nat_ops.to_longname = "lwp-layer";
-  linux_nat_ops.to_doc = "Low level threads support (LWP layer)";
-  linux_nat_ops.to_attach = linux_nat_attach;
-  linux_nat_ops.to_detach = linux_nat_detach;
-  linux_nat_ops.to_resume = linux_nat_resume;
-  linux_nat_ops.to_wait = linux_nat_wait;
-  /* fetch_inferior_registers and store_inferior_registers will
-     honor the LWP id, so we can use them directly.  */
-  linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
-  linux_nat_ops.to_store_registers = store_inferior_registers;
-  linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
-  linux_nat_ops.to_kill = linux_nat_kill;
-  linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
-  linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
-  linux_nat_ops.to_thread_alive = linux_nat_thread_alive;
-  linux_nat_ops.to_pid_to_str = linux_nat_pid_to_str;
-  linux_nat_ops.to_post_startup_inferior = child_post_startup_inferior;
-  linux_nat_ops.to_post_attach = child_post_attach;
-  linux_nat_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
-  linux_nat_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
-  linux_nat_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
-
-  linux_nat_ops.to_stratum = thread_stratum;
-  linux_nat_ops.to_has_thread_control = tc_schedlock;
-  linux_nat_ops.to_magic = OPS_MAGIC;
-}
-
-static void
-sigchld_handler (int signo)
-{
-  /* Do nothing.  The only reason for this handler is that it allows
-     us to use sigsuspend in linux_nat_wait above to wait for the
-     arrival of a SIGCHLD.  */
-}
-
-/* Accepts an integer PID; Returns a string representing a file that
-   can be opened to get the symbols for the child process.  */
-
-char *
-child_pid_to_exec_file (int pid)
-{
-  char *name1, *name2;
-
-  name1 = xmalloc (MAXPATHLEN);
-  name2 = xmalloc (MAXPATHLEN);
-  make_cleanup (xfree, name1);
-  make_cleanup (xfree, name2);
-  memset (name2, 0, MAXPATHLEN);
-
-  sprintf (name1, "/proc/%d/exe", pid);
-  if (readlink (name1, name2, MAXPATHLEN) > 0)
-    return name2;
-  else
-    return name1;
-}
-
-/* Service function for corefiles and info proc.  */
-
-static int
-read_mapping (FILE *mapfile,
-	      long long *addr,
-	      long long *endaddr,
-	      char *permissions,
-	      long long *offset,
-	      char *device, long long *inode, char *filename)
-{
-  int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
-		    addr, endaddr, permissions, offset, device, inode);
-
-  if (ret > 0 && ret != EOF && *inode != 0)
-    {
-      /* Eat everything up to EOL for the filename.  This will prevent
-         weird filenames (such as one with embedded whitespace) from
-         confusing this code.  It also makes this code more robust in
-         respect to annotations the kernel may add after the filename.
-
-         Note the filename is used for informational purposes
-         only.  */
-      ret += fscanf (mapfile, "%[^\n]\n", filename);
-    }
-  else
-    {
-      filename[0] = '\0';	/* no filename */
-      fscanf (mapfile, "\n");
-    }
-  return (ret != 0 && ret != EOF);
-}
-
-/* Fills the "to_find_memory_regions" target vector.  Lists the memory
-   regions in the inferior for a corefile.  */
-
-static int
-linux_nat_find_memory_regions (int (*func) (CORE_ADDR,
-					    unsigned long,
-					    int, int, int, void *), void *obfd)
-{
-  long long pid = PIDGET (inferior_ptid);
-  char mapsfilename[MAXPATHLEN];
-  FILE *mapsfile;
-  long long addr, endaddr, size, offset, inode;
-  char permissions[8], device[8], filename[MAXPATHLEN];
-  int read, write, exec;
-  int ret;
-
-  /* Compose the filename for the /proc memory map, and open it.  */
-  sprintf (mapsfilename, "/proc/%lld/maps", pid);
-  if ((mapsfile = fopen (mapsfilename, "r")) == NULL)
-    error ("Could not open %s\n", mapsfilename);
-
-  if (info_verbose)
-    fprintf_filtered (gdb_stdout,
-		      "Reading memory regions from %s\n", mapsfilename);
-
-  /* Now iterate until end-of-file.  */
-  while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
-		       &offset, &device[0], &inode, &filename[0]))
-    {
-      size = endaddr - addr;
-
-      /* Get the segment's permissions.  */
-      read = (strchr (permissions, 'r') != 0);
-      write = (strchr (permissions, 'w') != 0);
-      exec = (strchr (permissions, 'x') != 0);
-
-      if (info_verbose)
-	{
-	  fprintf_filtered (gdb_stdout,
-			    "Save segment, %lld bytes at 0x%s (%c%c%c)",
-			    size, paddr_nz (addr),
-			    read ? 'r' : ' ',
-			    write ? 'w' : ' ', exec ? 'x' : ' ');
-	  if (filename && filename[0])
-	    fprintf_filtered (gdb_stdout, " for %s", filename);
-	  fprintf_filtered (gdb_stdout, "\n");
-	}
-
-      /* Invoke the callback function to create the corefile
-	 segment.  */
-      func (addr, size, read, write, exec, obfd);
-    }
-  fclose (mapsfile);
-  return 0;
-}
-
-/* Records the thread's register state for the corefile note
-   section.  */
-
-static char *
-linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
-			       char *note_data, int *note_size)
-{
-  gdb_gregset_t gregs;
-  gdb_fpregset_t fpregs;
-#ifdef FILL_FPXREGSET
-  gdb_fpxregset_t fpxregs;
-#endif
-  unsigned long lwp = ptid_get_lwp (ptid);
-
-  fill_gregset (&gregs, -1);
-  note_data = (char *) elfcore_write_prstatus (obfd,
-					       note_data,
-					       note_size,
-					       lwp,
-					       stop_signal, &gregs);
-
-  fill_fpregset (&fpregs, -1);
-  note_data = (char *) elfcore_write_prfpreg (obfd,
-					      note_data,
-					      note_size,
-					      &fpregs, sizeof (fpregs));
-#ifdef FILL_FPXREGSET
-  fill_fpxregset (&fpxregs, -1);
-  note_data = (char *) elfcore_write_prxfpreg (obfd,
-					       note_data,
-					       note_size,
-					       &fpxregs, sizeof (fpxregs));
-#endif
-  return note_data;
-}
-
-struct linux_nat_corefile_thread_data
-{
-  bfd *obfd;
-  char *note_data;
-  int *note_size;
-  int num_notes;
-};
-
-/* Called by gdbthread.c once per thread.  Records the thread's
-   register state for the corefile note section.  */
-
-static int
-linux_nat_corefile_thread_callback (struct lwp_info *ti, void *data)
-{
-  struct linux_nat_corefile_thread_data *args = data;
-  ptid_t saved_ptid = inferior_ptid;
-
-  inferior_ptid = ti->ptid;
-  registers_changed ();
-  target_fetch_registers (-1);	/* FIXME should not be necessary;
-				   fill_gregset should do it automatically. */
-  args->note_data = linux_nat_do_thread_registers (args->obfd,
-						   ti->ptid,
-						   args->note_data,
-						   args->note_size);
-  args->num_notes++;
-  inferior_ptid = saved_ptid;
-  registers_changed ();
-  target_fetch_registers (-1);	/* FIXME should not be necessary;
-				   fill_gregset should do it automatically. */
-  return 0;
-}
-
-/* Records the register state for the corefile note section.  */
-
-static char *
-linux_nat_do_registers (bfd *obfd, ptid_t ptid,
-			char *note_data, int *note_size)
-{
-  registers_changed ();
-  target_fetch_registers (-1);	/* FIXME should not be necessary;
-				   fill_gregset should do it automatically. */
-  return linux_nat_do_thread_registers (obfd,
-					ptid_build (ptid_get_pid (inferior_ptid),
-						    ptid_get_pid (inferior_ptid),
-						    0),
-					note_data, note_size);
-  return note_data;
-}
-
-/* Fills the "to_make_corefile_note" target vector.  Builds the note
-   section for a corefile, and returns it in a malloc buffer.  */
-
-static char *
-linux_nat_make_corefile_notes (bfd *obfd, int *note_size)
-{
-  struct linux_nat_corefile_thread_data thread_args;
-  struct cleanup *old_chain;
-  char fname[16] = { '\0' };
-  char psargs[80] = { '\0' };
-  char *note_data = NULL;
-  ptid_t current_ptid = inferior_ptid;
-  char *auxv;
-  int auxv_len;
-
-  if (get_exec_file (0))
-    {
-      strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
-      strncpy (psargs, get_exec_file (0), sizeof (psargs));
-      if (get_inferior_args ())
-	{
-	  strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
-	  strncat (psargs, get_inferior_args (),
-		   sizeof (psargs) - strlen (psargs));
-	}
-      note_data = (char *) elfcore_write_prpsinfo (obfd,
-						   note_data,
-						   note_size, fname, psargs);
-    }
-
-  /* Dump information for threads.  */
-  thread_args.obfd = obfd;
-  thread_args.note_data = note_data;
-  thread_args.note_size = note_size;
-  thread_args.num_notes = 0;
-  iterate_over_lwps (linux_nat_corefile_thread_callback, &thread_args);
-  if (thread_args.num_notes == 0)
-    {
-      /* iterate_over_threads didn't come up with any threads; just
-         use inferior_ptid.  */
-      note_data = linux_nat_do_registers (obfd, inferior_ptid,
-					  note_data, note_size);
-    }
-  else
-    {
-      note_data = thread_args.note_data;
-    }
-
-  auxv_len = target_auxv_read (&current_target, &auxv);
-  if (auxv_len > 0)
-    {
-      note_data = elfcore_write_note (obfd, note_data, note_size,
-				      "CORE", NT_AUXV, auxv, auxv_len);
-      xfree (auxv);
-    }
-
-  make_cleanup (xfree, note_data);
-  return note_data;
-}
-
-/* Implement the "info proc" command.  */
-
-static void
-linux_nat_info_proc_cmd (char *args, int from_tty)
-{
-  long long pid = PIDGET (inferior_ptid);
-  FILE *procfile;
-  char **argv = NULL;
-  char buffer[MAXPATHLEN];
-  char fname1[MAXPATHLEN], fname2[MAXPATHLEN];
-  int cmdline_f = 1;
-  int cwd_f = 1;
-  int exe_f = 1;
-  int mappings_f = 0;
-  int environ_f = 0;
-  int status_f = 0;
-  int stat_f = 0;
-  int all = 0;
-  struct stat dummy;
-
-  if (args)
-    {
-      /* Break up 'args' into an argv array.  */
-      if ((argv = buildargv (args)) == NULL)
-	nomem (0);
-      else
-	make_cleanup_freeargv (argv);
-    }
-  while (argv != NULL && *argv != NULL)
-    {
-      if (isdigit (argv[0][0]))
-	{
-	  pid = strtoul (argv[0], NULL, 10);
-	}
-      else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
-	{
-	  mappings_f = 1;
-	}
-      else if (strcmp (argv[0], "status") == 0)
-	{
-	  status_f = 1;
-	}
-      else if (strcmp (argv[0], "stat") == 0)
-	{
-	  stat_f = 1;
-	}
-      else if (strcmp (argv[0], "cmd") == 0)
-	{
-	  cmdline_f = 1;
-	}
-      else if (strncmp (argv[0], "exe", strlen (argv[0])) == 0)
-	{
-	  exe_f = 1;
-	}
-      else if (strcmp (argv[0], "cwd") == 0)
-	{
-	  cwd_f = 1;
-	}
-      else if (strncmp (argv[0], "all", strlen (argv[0])) == 0)
-	{
-	  all = 1;
-	}
-      else
-	{
-	  /* [...] (future options here) */
-	}
-      argv++;
-    }
-  if (pid == 0)
-    error ("No current process: you must name one.");
-
-  sprintf (fname1, "/proc/%lld", pid);
-  if (stat (fname1, &dummy) != 0)
-    error ("No /proc directory: '%s'", fname1);
-
-  printf_filtered ("process %lld\n", pid);
-  if (cmdline_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/cmdline", pid);
-      if ((procfile = fopen (fname1, "r")) > 0)
-	{
-	  fgets (buffer, sizeof (buffer), procfile);
-	  printf_filtered ("cmdline = '%s'\n", buffer);
-	  fclose (procfile);
-	}
-      else
-	warning ("unable to open /proc file '%s'", fname1);
-    }
-  if (cwd_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/cwd", pid);
-      memset (fname2, 0, sizeof (fname2));
-      if (readlink (fname1, fname2, sizeof (fname2)) > 0)
-	printf_filtered ("cwd = '%s'\n", fname2);
-      else
-	warning ("unable to read link '%s'", fname1);
-    }
-  if (exe_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/exe", pid);
-      memset (fname2, 0, sizeof (fname2));
-      if (readlink (fname1, fname2, sizeof (fname2)) > 0)
-	printf_filtered ("exe = '%s'\n", fname2);
-      else
-	warning ("unable to read link '%s'", fname1);
-    }
-  if (mappings_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/maps", pid);
-      if ((procfile = fopen (fname1, "r")) > 0)
-	{
-	  long long addr, endaddr, size, offset, inode;
-	  char permissions[8], device[8], filename[MAXPATHLEN];
-
-	  printf_filtered ("Mapped address spaces:\n\n");
-	  if (TARGET_ADDR_BIT == 32)
-	    {
-	      printf_filtered ("\t%10s %10s %10s %10s %7s\n",
-			   "Start Addr",
-			   "  End Addr",
-			   "      Size", "    Offset", "objfile");
-            }
-	  else
-            {
-	      printf_filtered ("  %18s %18s %10s %10s %7s\n",
-			   "Start Addr",
-			   "  End Addr",
-			   "      Size", "    Offset", "objfile");
-	    }
-
-	  while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
-			       &offset, &device[0], &inode, &filename[0]))
-	    {
-	      size = endaddr - addr;
-
-	      /* FIXME: carlton/2003-08-27: Maybe the printf_filtered
-		 calls here (and possibly above) should be abstracted
-		 out into their own functions?  Andrew suggests using
-		 a generic local_address_string instead to print out
-		 the addresses; that makes sense to me, too.  */
-
-	      if (TARGET_ADDR_BIT == 32)
-	        {
-	          printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
-			       (unsigned long) addr,	/* FIXME: pr_addr */
-			       (unsigned long) endaddr,
-			       (int) size,
-			       (unsigned int) offset,
-			       filename[0] ? filename : "");
-		}
-	      else
-	        {
-	          printf_filtered ("  %#18lx %#18lx %#10x %#10x %7s\n",
-			       (unsigned long) addr,	/* FIXME: pr_addr */
-			       (unsigned long) endaddr,
-			       (int) size,
-			       (unsigned int) offset,
-			       filename[0] ? filename : "");
-	        }
-	    }
-
-	  fclose (procfile);
-	}
-      else
-	warning ("unable to open /proc file '%s'", fname1);
-    }
-  if (status_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/status", pid);
-      if ((procfile = fopen (fname1, "r")) > 0)
-	{
-	  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
-	    puts_filtered (buffer);
-	  fclose (procfile);
-	}
-      else
-	warning ("unable to open /proc file '%s'", fname1);
-    }
-  if (stat_f || all)
-    {
-      sprintf (fname1, "/proc/%lld/stat", pid);
-      if ((procfile = fopen (fname1, "r")) > 0)
-	{
-	  int itmp;
-	  char ctmp;
-
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Process: %d\n", itmp);
-	  if (fscanf (procfile, "%s ", &buffer[0]) > 0)
-	    printf_filtered ("Exec file: %s\n", buffer);
-	  if (fscanf (procfile, "%c ", &ctmp) > 0)
-	    printf_filtered ("State: %c\n", ctmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Parent process: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Process group: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Session id: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("TTY: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("TTY owner process group: %d\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Flags: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Minor faults (no memory page): %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Minor faults, children: %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Major faults (memory page faults): %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Major faults, children: %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("utime: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("stime: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("utime, children: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("stime, children: %d\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("jiffies remaining in current time slice: %d\n",
-			     itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("'nice' value: %d\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("jiffies until next timeout: %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("jiffies until next SIGALRM: %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("start time (jiffies since system boot): %d\n",
-			     itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Virtual memory size: %u\n",
-			     (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("rlim: %u\n", (unsigned int) itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Start of text: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("End of text: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)
-	    printf_filtered ("Start of stack: 0x%x\n", itmp);
-#if 0				/* Don't know how architecture-dependent the rest is...
-				   Anyway the signal bitmap info is available from "status".  */
-	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
-	    printf_filtered ("Kernel stack pointer: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
-	    printf_filtered ("Kernel instr pointer: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Pending signals bitmap: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Blocked signals bitmap: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Ignored signals bitmap: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%d ", &itmp) > 0)
-	    printf_filtered ("Catched signals bitmap: 0x%x\n", itmp);
-	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
-	    printf_filtered ("wchan (system call): 0x%x\n", itmp);
-#endif
-	  fclose (procfile);
-	}
-      else
-	warning ("unable to open /proc file '%s'", fname1);
-    }
-}
-
-int
-linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
-			struct mem_attrib *attrib, struct target_ops *target)
-{
-  int fd, ret;
-  char filename[64];
-
-  if (write)
-    return 0;
-
-  /* Don't bother for one word.  */
-  if (len < 3 * sizeof (long))
-    return 0;
-
-  /* We could keep this file open and cache it - possibly one per
-     thread.  That requires some juggling, but is even faster.  */
-  sprintf (filename, "/proc/%d/mem", PIDGET (inferior_ptid));
-  fd = open (filename, O_RDONLY | O_LARGEFILE);
-  if (fd == -1)
-    return 0;
-
-  /* If pread64 is available, use it.  It's faster if the kernel
-     supports it (only one syscall), and it's 64-bit safe even on
-     32-bit platforms (for instance, SPARC debugging a SPARC64
-     application).  */
-#ifdef HAVE_PREAD64
-  if (pread64 (fd, myaddr, len, addr) != len)
-#else
-  if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
-#endif
-    ret = 0;
-  else
-    ret = len;
-
-  close (fd);
-  return ret;
-}
-
-/* Parse LINE as a signal set and add its set bits to SIGS.  */
-
-static void
-add_line_to_sigset (const char *line, sigset_t *sigs)
-{
-  int len = strlen (line) - 1;
-  const char *p;
-  int signum;
-
-  if (line[len] != '\n')
-    error ("Could not parse signal set: %s", line);
-
-  p = line;
-  signum = len * 4;
-  while (len-- > 0)
-    {
-      int digit;
-
-      if (*p >= '0' && *p <= '9')
-	digit = *p - '0';
-      else if (*p >= 'a' && *p <= 'f')
-	digit = *p - 'a' + 10;
-      else
-	error ("Could not parse signal set: %s", line);
-
-      signum -= 4;
-
-      if (digit & 1)
-	sigaddset (sigs, signum + 1);
-      if (digit & 2)
-	sigaddset (sigs, signum + 2);
-      if (digit & 4)
-	sigaddset (sigs, signum + 3);
-      if (digit & 8)
-	sigaddset (sigs, signum + 4);
-
-      p++;
-    }
-}
-
-/* Find process PID's pending signals from /proc/pid/status and set
-   SIGS to match.  */
-
-void
-linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored)
-{
-  FILE *procfile;
-  char buffer[MAXPATHLEN], fname[MAXPATHLEN];
-  int signum;
-
-  sigemptyset (pending);
-  sigemptyset (blocked);
-  sigemptyset (ignored);
-  sprintf (fname, "/proc/%d/status", pid);
-  procfile = fopen (fname, "r");
-  if (procfile == NULL)
-    error ("Could not open %s", fname);
-
-  while (fgets (buffer, MAXPATHLEN, procfile) != NULL)
-    {
-      /* Normal queued signals are on the SigPnd line in the status
-	 file.  However, 2.6 kernels also have a "shared" pending
-	 queue for delivering signals to a thread group, so check for
-	 a ShdPnd line also.
-
-	 Unfortunately some Red Hat kernels include the shared pending
-	 queue but not the ShdPnd status field.  */
-
-      if (strncmp (buffer, "SigPnd:\t", 8) == 0)
-	add_line_to_sigset (buffer + 8, pending);
-      else if (strncmp (buffer, "ShdPnd:\t", 8) == 0)
-	add_line_to_sigset (buffer + 8, pending);
-      else if (strncmp (buffer, "SigBlk:\t", 8) == 0)
-	add_line_to_sigset (buffer + 8, blocked);
-      else if (strncmp (buffer, "SigIgn:\t", 8) == 0)
-	add_line_to_sigset (buffer + 8, ignored);
-    }
-
-  fclose (procfile);
-}
-
-void
-_initialize_linux_nat (void)
-{
-  struct sigaction action;
-  extern void thread_db_init (struct target_ops *);
-
-  deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
-  deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
-
-  add_info ("proc", linux_nat_info_proc_cmd,
-	    "Show /proc process information about any running process.\n\
-Specify any process id, or use the program being debugged by default.\n\
-Specify any of the following keywords for detailed info:\n\
-  mappings -- list of mapped memory regions.\n\
-  stat     -- list a bunch of random process info.\n\
-  status   -- list a different bunch of random process info.\n\
-  all      -- list all available /proc info.");
-
-  init_linux_nat_ops ();
-  add_target (&linux_nat_ops);
-  thread_db_init (&linux_nat_ops);
-
-  /* Save the original signal mask.  */
-  sigprocmask (SIG_SETMASK, NULL, &normal_mask);
-
-  action.sa_handler = sigchld_handler;
-  sigemptyset (&action.sa_mask);
-  action.sa_flags = 0;
-  sigaction (SIGCHLD, &action, NULL);
-
-  /* Make sure we don't block SIGCHLD during a sigsuspend.  */
-  sigprocmask (SIG_SETMASK, NULL, &suspend_mask);
-  sigdelset (&suspend_mask, SIGCHLD);
-
-  sigemptyset (&blocked_mask);
-
-  deprecated_add_show_from_set
-    (add_set_cmd ("lin-lwp", no_class, var_zinteger,
-		  (char *) &debug_linux_nat,
-		  "Set debugging of GNU/Linux lwp module.\n\
-Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
-}
-
-
-/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
-   the GNU/Linux Threads library and therefore doesn't really belong
-   here.  */
-
-/* Read variable NAME in the target and return its value if found.
-   Otherwise return zero.  It is assumed that the type of the variable
-   is `int'.  */
-
-static int
-get_signo (const char *name)
-{
-  struct minimal_symbol *ms;
-  int signo;
-
-  ms = lookup_minimal_symbol (name, NULL, NULL);
-  if (ms == NULL)
-    return 0;
-
-  if (target_read_memory (SYMBOL_VALUE_ADDRESS (ms), (char *) &signo,
-			  sizeof (signo)) != 0)
-    return 0;
-
-  return signo;
-}
-
-/* Return the set of signals used by the threads library in *SET.  */
-
-void
-lin_thread_get_thread_signals (sigset_t *set)
-{
-  struct sigaction action;
-  int restart, cancel;
-
-  sigemptyset (set);
-
-  restart = get_signo ("__pthread_sig_restart");
-  if (restart == 0)
-    return;
-
-  cancel = get_signo ("__pthread_sig_cancel");
-  if (cancel == 0)
-    return;
-
-  sigaddset (set, restart);
-  sigaddset (set, cancel);
-
-  /* The GNU/Linux Threads library makes terminating threads send a
-     special "cancel" signal instead of SIGCHLD.  Make sure we catch
-     those (to prevent them from terminating GDB itself, which is
-     likely to be their default action) and treat them the same way as
-     SIGCHLD.  */
-
-  action.sa_handler = sigchld_handler;
-  sigemptyset (&action.sa_mask);
-  action.sa_flags = 0;
-  sigaction (cancel, &action, NULL);
-
-  /* We block the "cancel" signal throughout this code ...  */
-  sigaddset (&blocked_mask, cancel);
-  sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
-
-  /* ... except during a sigsuspend.  */
-  sigdelset (&suspend_mask, cancel);
-}
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
new file mode 100644
index 0000000..0a77459
--- /dev/null
+++ b/gdb/linux-proc.c
@@ -0,0 +1,737 @@
+/* GNU/Linux specific methods for using the /proc file system.
+
+   Copyright 2001, 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "inferior.h"
+#include <sys/param.h>		/* for MAXPATHLEN */
+#include <sys/procfs.h>		/* for elf_gregset etc. */
+#include "gdb_stat.h"		/* for struct stat */
+#include <ctype.h>		/* for isdigit */
+#include <unistd.h>		/* for open, pread64 */
+#include <fcntl.h>		/* for O_RDONLY */
+#include "regcache.h"		/* for registers_changed */
+#include "gregset.h"		/* for gregset */
+#include "gdbcore.h"		/* for get_exec_file */
+#include "gdbthread.h"		/* for struct thread_info etc. */
+#include "elf-bfd.h"		/* for elfcore_write_* */
+#include "cli/cli-decode.h"	/* for add_info */
+#include "gdb_string.h"
+
+#include <signal.h>
+
+#include "linux-nat.h"
+
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
+/* Function: child_pid_to_exec_file
+ *
+ * Accepts an integer pid
+ * Returns a string representing a file that can be opened
+ * to get the symbols for the child process.
+ */
+
+char *
+child_pid_to_exec_file (int pid)
+{
+  char *name1, *name2;
+
+  name1 = xmalloc (MAXPATHLEN);
+  name2 = xmalloc (MAXPATHLEN);
+  make_cleanup (xfree, name1);
+  make_cleanup (xfree, name2);
+  memset (name2, 0, MAXPATHLEN);
+
+  sprintf (name1, "/proc/%d/exe", pid);
+  if (readlink (name1, name2, MAXPATHLEN) > 0)
+    return name2;
+  else
+    return name1;
+}
+
+/* Function: read_mappings
+ *
+ * Service function for corefiles and info proc.
+ */
+
+static int
+read_mapping (FILE *mapfile,
+	      long long *addr,
+	      long long *endaddr,
+	      char *permissions,
+	      long long *offset,
+	      char *device, long long *inode, char *filename)
+{
+  int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
+		    addr, endaddr, permissions, offset, device, inode);
+
+  if (ret > 0 && ret != EOF && *inode != 0)
+    {
+      /* Eat everything up to EOL for the filename.  This will prevent
+         weird filenames (such as one with embedded whitespace) from
+         confusing this code.  It also makes this code more robust
+         in respect to annotations the kernel may add after the
+         filename.
+
+         Note the filename is used for informational purposes only.  */
+      ret += fscanf (mapfile, "%[^\n]\n", filename);
+    }
+  else
+    {
+      filename[0] = '\0';	/* no filename */
+      fscanf (mapfile, "\n");
+    }
+  return (ret != 0 && ret != EOF);
+}
+
+/* Function: linux_find_memory_regions
+ *
+ * Fills the "to_find_memory_regions" target vector.
+ * Lists the memory regions in the inferior for a corefile.
+ */
+
+static int
+linux_find_memory_regions (int (*func) (CORE_ADDR,
+					unsigned long,
+					int, int, int, void *), void *obfd)
+{
+  long long pid = PIDGET (inferior_ptid);
+  char mapsfilename[MAXPATHLEN];
+  FILE *mapsfile;
+  long long addr, endaddr, size, offset, inode;
+  char permissions[8], device[8], filename[MAXPATHLEN];
+  int read, write, exec;
+  int ret;
+
+  /* Compose the filename for the /proc memory map, and open it. */
+  sprintf (mapsfilename, "/proc/%lld/maps", pid);
+  if ((mapsfile = fopen (mapsfilename, "r")) == NULL)
+    error ("Could not open %s\n", mapsfilename);
+
+  if (info_verbose)
+    fprintf_filtered (gdb_stdout,
+		      "Reading memory regions from %s\n", mapsfilename);
+
+  /* Now iterate until end-of-file. */
+  while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
+		       &offset, &device[0], &inode, &filename[0]))
+    {
+      size = endaddr - addr;
+
+      /* Get the segment's permissions.  */
+      read = (strchr (permissions, 'r') != 0);
+      write = (strchr (permissions, 'w') != 0);
+      exec = (strchr (permissions, 'x') != 0);
+
+      if (info_verbose)
+	{
+	  fprintf_filtered (gdb_stdout,
+			    "Save segment, %lld bytes at 0x%s (%c%c%c)",
+			    size, paddr_nz (addr),
+			    read ? 'r' : ' ',
+			    write ? 'w' : ' ', exec ? 'x' : ' ');
+	  if (filename && filename[0])
+	    fprintf_filtered (gdb_stdout, " for %s", filename);
+	  fprintf_filtered (gdb_stdout, "\n");
+	}
+
+      /* Invoke the callback function to create the corefile segment. */
+      func (addr, size, read, write, exec, obfd);
+    }
+  fclose (mapsfile);
+  return 0;
+}
+
+/* Function: linux_do_thread_registers
+ *
+ * Records the thread's register state for the corefile note section.
+ */
+
+static char *
+linux_do_thread_registers (bfd *obfd, ptid_t ptid,
+			   char *note_data, int *note_size)
+{
+  gdb_gregset_t gregs;
+  gdb_fpregset_t fpregs;
+#ifdef FILL_FPXREGSET
+  gdb_fpxregset_t fpxregs;
+#endif
+  unsigned long lwp = ptid_get_lwp (ptid);
+
+  fill_gregset (&gregs, -1);
+  note_data = (char *) elfcore_write_prstatus (obfd,
+					       note_data,
+					       note_size,
+					       lwp,
+					       stop_signal, &gregs);
+
+  fill_fpregset (&fpregs, -1);
+  note_data = (char *) elfcore_write_prfpreg (obfd,
+					      note_data,
+					      note_size,
+					      &fpregs, sizeof (fpregs));
+#ifdef FILL_FPXREGSET
+  fill_fpxregset (&fpxregs, -1);
+  note_data = (char *) elfcore_write_prxfpreg (obfd,
+					       note_data,
+					       note_size,
+					       &fpxregs, sizeof (fpxregs));
+#endif
+  return note_data;
+}
+
+struct linux_corefile_thread_data
+{
+  bfd *obfd;
+  char *note_data;
+  int *note_size;
+  int num_notes;
+};
+
+/* Function: linux_corefile_thread_callback
+ *
+ * Called by gdbthread.c once per thread.
+ * Records the thread's register state for the corefile note section.
+ */
+
+static int
+linux_corefile_thread_callback (struct lwp_info *ti, void *data)
+{
+  struct linux_corefile_thread_data *args = data;
+  ptid_t saved_ptid = inferior_ptid;
+
+  inferior_ptid = ti->ptid;
+  registers_changed ();
+  target_fetch_registers (-1);	/* FIXME should not be necessary;
+				   fill_gregset should do it automatically. */
+  args->note_data = linux_do_thread_registers (args->obfd,
+					       ti->ptid,
+					       args->note_data,
+					       args->note_size);
+  args->num_notes++;
+  inferior_ptid = saved_ptid;
+  registers_changed ();
+  target_fetch_registers (-1);	/* FIXME should not be necessary;
+				   fill_gregset should do it automatically. */
+  return 0;
+}
+
+/* Function: linux_do_registers
+ *
+ * Records the register state for the corefile note section.
+ */
+
+static char *
+linux_do_registers (bfd *obfd, ptid_t ptid,
+		    char *note_data, int *note_size)
+{
+  registers_changed ();
+  target_fetch_registers (-1);	/* FIXME should not be necessary;
+				   fill_gregset should do it automatically. */
+  return linux_do_thread_registers (obfd,
+				    ptid_build (ptid_get_pid (inferior_ptid),
+						ptid_get_pid (inferior_ptid),
+						0),
+				    note_data, note_size);
+  return note_data;
+}
+
+/* Function: linux_make_note_section
+ *
+ * Fills the "to_make_corefile_note" target vector.
+ * Builds the note section for a corefile, and returns it
+ * in a malloc buffer.
+ */
+
+static char *
+linux_make_note_section (bfd *obfd, int *note_size)
+{
+  struct linux_corefile_thread_data thread_args;
+  struct cleanup *old_chain;
+  char fname[16] = { '\0' };
+  char psargs[80] = { '\0' };
+  char *note_data = NULL;
+  ptid_t current_ptid = inferior_ptid;
+  char *auxv;
+  int auxv_len;
+
+  if (get_exec_file (0))
+    {
+      strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
+      strncpy (psargs, get_exec_file (0), sizeof (psargs));
+      if (get_inferior_args ())
+	{
+	  strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
+	  strncat (psargs, get_inferior_args (),
+		   sizeof (psargs) - strlen (psargs));
+	}
+      note_data = (char *) elfcore_write_prpsinfo (obfd,
+						   note_data,
+						   note_size, fname, psargs);
+    }
+
+  /* Dump information for threads.  */
+  thread_args.obfd = obfd;
+  thread_args.note_data = note_data;
+  thread_args.note_size = note_size;
+  thread_args.num_notes = 0;
+  iterate_over_lwps (linux_corefile_thread_callback, &thread_args);
+  if (thread_args.num_notes == 0)
+    {
+      /* iterate_over_threads didn't come up with any threads;
+         just use inferior_ptid.  */
+      note_data = linux_do_registers (obfd, inferior_ptid,
+				      note_data, note_size);
+    }
+  else
+    {
+      note_data = thread_args.note_data;
+    }
+
+  auxv_len = target_auxv_read (&current_target, &auxv);
+  if (auxv_len > 0)
+    {
+      note_data = elfcore_write_note (obfd, note_data, note_size,
+				      "CORE", NT_AUXV, auxv, auxv_len);
+      xfree (auxv);
+    }
+
+  make_cleanup (xfree, note_data);
+  return note_data;
+}
+
+/*
+ * Function: linux_info_proc_cmd
+ *
+ * Implement the "info proc" command.
+ */
+
+static void
+linux_info_proc_cmd (char *args, int from_tty)
+{
+  long long pid = PIDGET (inferior_ptid);
+  FILE *procfile;
+  char **argv = NULL;
+  char buffer[MAXPATHLEN];
+  char fname1[MAXPATHLEN], fname2[MAXPATHLEN];
+  int cmdline_f = 1;
+  int cwd_f = 1;
+  int exe_f = 1;
+  int mappings_f = 0;
+  int environ_f = 0;
+  int status_f = 0;
+  int stat_f = 0;
+  int all = 0;
+  struct stat dummy;
+
+  if (args)
+    {
+      /* Break up 'args' into an argv array. */
+      if ((argv = buildargv (args)) == NULL)
+	nomem (0);
+      else
+	make_cleanup_freeargv (argv);
+    }
+  while (argv != NULL && *argv != NULL)
+    {
+      if (isdigit (argv[0][0]))
+	{
+	  pid = strtoul (argv[0], NULL, 10);
+	}
+      else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
+	{
+	  mappings_f = 1;
+	}
+      else if (strcmp (argv[0], "status") == 0)
+	{
+	  status_f = 1;
+	}
+      else if (strcmp (argv[0], "stat") == 0)
+	{
+	  stat_f = 1;
+	}
+      else if (strcmp (argv[0], "cmd") == 0)
+	{
+	  cmdline_f = 1;
+	}
+      else if (strncmp (argv[0], "exe", strlen (argv[0])) == 0)
+	{
+	  exe_f = 1;
+	}
+      else if (strcmp (argv[0], "cwd") == 0)
+	{
+	  cwd_f = 1;
+	}
+      else if (strncmp (argv[0], "all", strlen (argv[0])) == 0)
+	{
+	  all = 1;
+	}
+      else
+	{
+	  /* [...] (future options here) */
+	}
+      argv++;
+    }
+  if (pid == 0)
+    error ("No current process: you must name one.");
+
+  sprintf (fname1, "/proc/%lld", pid);
+  if (stat (fname1, &dummy) != 0)
+    error ("No /proc directory: '%s'", fname1);
+
+  printf_filtered ("process %lld\n", pid);
+  if (cmdline_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/cmdline", pid);
+      if ((procfile = fopen (fname1, "r")) > 0)
+	{
+	  fgets (buffer, sizeof (buffer), procfile);
+	  printf_filtered ("cmdline = '%s'\n", buffer);
+	  fclose (procfile);
+	}
+      else
+	warning ("unable to open /proc file '%s'", fname1);
+    }
+  if (cwd_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/cwd", pid);
+      memset (fname2, 0, sizeof (fname2));
+      if (readlink (fname1, fname2, sizeof (fname2)) > 0)
+	printf_filtered ("cwd = '%s'\n", fname2);
+      else
+	warning ("unable to read link '%s'", fname1);
+    }
+  if (exe_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/exe", pid);
+      memset (fname2, 0, sizeof (fname2));
+      if (readlink (fname1, fname2, sizeof (fname2)) > 0)
+	printf_filtered ("exe = '%s'\n", fname2);
+      else
+	warning ("unable to read link '%s'", fname1);
+    }
+  if (mappings_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/maps", pid);
+      if ((procfile = fopen (fname1, "r")) > 0)
+	{
+	  long long addr, endaddr, size, offset, inode;
+	  char permissions[8], device[8], filename[MAXPATHLEN];
+
+	  printf_filtered ("Mapped address spaces:\n\n");
+	  if (TARGET_ADDR_BIT == 32)
+	    {
+	      printf_filtered ("\t%10s %10s %10s %10s %7s\n",
+			   "Start Addr",
+			   "  End Addr",
+			   "      Size", "    Offset", "objfile");
+            }
+	  else
+            {
+	      printf_filtered ("  %18s %18s %10s %10s %7s\n",
+			   "Start Addr",
+			   "  End Addr",
+			   "      Size", "    Offset", "objfile");
+	    }
+
+	  while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
+			       &offset, &device[0], &inode, &filename[0]))
+	    {
+	      size = endaddr - addr;
+
+	      /* FIXME: carlton/2003-08-27: Maybe the printf_filtered
+		 calls here (and possibly above) should be abstracted
+		 out into their own functions?  Andrew suggests using
+		 a generic local_address_string instead to print out
+		 the addresses; that makes sense to me, too.  */
+
+	      if (TARGET_ADDR_BIT == 32)
+	        {
+	          printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
+			       (unsigned long) addr,	/* FIXME: pr_addr */
+			       (unsigned long) endaddr,
+			       (int) size,
+			       (unsigned int) offset,
+			       filename[0] ? filename : "");
+		}
+	      else
+	        {
+	          printf_filtered ("  %#18lx %#18lx %#10x %#10x %7s\n",
+			       (unsigned long) addr,	/* FIXME: pr_addr */
+			       (unsigned long) endaddr,
+			       (int) size,
+			       (unsigned int) offset,
+			       filename[0] ? filename : "");
+	        }
+	    }
+
+	  fclose (procfile);
+	}
+      else
+	warning ("unable to open /proc file '%s'", fname1);
+    }
+  if (status_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/status", pid);
+      if ((procfile = fopen (fname1, "r")) > 0)
+	{
+	  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
+	    puts_filtered (buffer);
+	  fclose (procfile);
+	}
+      else
+	warning ("unable to open /proc file '%s'", fname1);
+    }
+  if (stat_f || all)
+    {
+      sprintf (fname1, "/proc/%lld/stat", pid);
+      if ((procfile = fopen (fname1, "r")) > 0)
+	{
+	  int itmp;
+	  char ctmp;
+
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Process: %d\n", itmp);
+	  if (fscanf (procfile, "%s ", &buffer[0]) > 0)
+	    printf_filtered ("Exec file: %s\n", buffer);
+	  if (fscanf (procfile, "%c ", &ctmp) > 0)
+	    printf_filtered ("State: %c\n", ctmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Parent process: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Process group: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Session id: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("TTY: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("TTY owner process group: %d\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Flags: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Minor faults (no memory page): %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Minor faults, children: %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Major faults (memory page faults): %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Major faults, children: %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("utime: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("stime: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("utime, children: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("stime, children: %d\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("jiffies remaining in current time slice: %d\n",
+			     itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("'nice' value: %d\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("jiffies until next timeout: %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("jiffies until next SIGALRM: %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("start time (jiffies since system boot): %d\n",
+			     itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Virtual memory size: %u\n",
+			     (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("rlim: %u\n", (unsigned int) itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Start of text: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("End of text: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)
+	    printf_filtered ("Start of stack: 0x%x\n", itmp);
+#if 0				/* Don't know how architecture-dependent the rest is...
+				   Anyway the signal bitmap info is available from "status".  */
+	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
+	    printf_filtered ("Kernel stack pointer: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
+	    printf_filtered ("Kernel instr pointer: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Pending signals bitmap: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Blocked signals bitmap: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Ignored signals bitmap: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%d ", &itmp) > 0)
+	    printf_filtered ("Catched signals bitmap: 0x%x\n", itmp);
+	  if (fscanf (procfile, "%u ", &itmp) > 0)	/* FIXME arch? */
+	    printf_filtered ("wchan (system call): 0x%x\n", itmp);
+#endif
+	  fclose (procfile);
+	}
+      else
+	warning ("unable to open /proc file '%s'", fname1);
+    }
+}
+
+void
+_initialize_linux_proc (void)
+{
+  extern void inftarg_set_find_memory_regions ();
+  extern void inftarg_set_make_corefile_notes ();
+
+  inftarg_set_find_memory_regions (linux_find_memory_regions);
+  inftarg_set_make_corefile_notes (linux_make_note_section);
+
+  add_info ("proc", linux_info_proc_cmd,
+	    "Show /proc process information about any running process.\n\
+Specify any process id, or use the program being debugged by default.\n\
+Specify any of the following keywords for detailed info:\n\
+  mappings -- list of mapped memory regions.\n\
+  stat     -- list a bunch of random process info.\n\
+  status   -- list a different bunch of random process info.\n\
+  all      -- list all available /proc info.");
+}
+
+int
+linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
+			struct mem_attrib *attrib, struct target_ops *target)
+{
+  int fd, ret;
+  char filename[64];
+
+  if (write)
+    return 0;
+
+  /* Don't bother for one word.  */
+  if (len < 3 * sizeof (long))
+    return 0;
+
+  /* We could keep this file open and cache it - possibly one
+     per thread.  That requires some juggling, but is even faster.  */
+  sprintf (filename, "/proc/%d/mem", PIDGET (inferior_ptid));
+  fd = open (filename, O_RDONLY | O_LARGEFILE);
+  if (fd == -1)
+    return 0;
+
+  /* If pread64 is available, use it.  It's faster if the kernel
+     supports it (only one syscall), and it's 64-bit safe even
+     on 32-bit platforms (for instance, SPARC debugging a SPARC64
+     application).  */
+#ifdef HAVE_PREAD64
+  if (pread64 (fd, myaddr, len, addr) != len)
+#else
+  if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
+#endif
+    ret = 0;
+  else
+    ret = len;
+
+  close (fd);
+  return ret;
+}
+
+/* Parse LINE as a signal set and add its set bits to SIGS.  */
+
+static void
+linux_proc_add_line_to_sigset (const char *line, sigset_t *sigs)
+{
+  int len = strlen (line) - 1;
+  const char *p;
+  int signum;
+
+  if (line[len] != '\n')
+    error ("Could not parse signal set: %s", line);
+
+  p = line;
+  signum = len * 4;
+  while (len-- > 0)
+    {
+      int digit;
+
+      if (*p >= '0' && *p <= '9')
+	digit = *p - '0';
+      else if (*p >= 'a' && *p <= 'f')
+	digit = *p - 'a' + 10;
+      else
+	error ("Could not parse signal set: %s", line);
+
+      signum -= 4;
+
+      if (digit & 1)
+	sigaddset (sigs, signum + 1);
+      if (digit & 2)
+	sigaddset (sigs, signum + 2);
+      if (digit & 4)
+	sigaddset (sigs, signum + 3);
+      if (digit & 8)
+	sigaddset (sigs, signum + 4);
+
+      p++;
+    }
+}
+
+/* Find process PID's pending signals from /proc/pid/status and set SIGS
+   to match.  */
+
+void
+linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored)
+{
+  FILE *procfile;
+  char buffer[MAXPATHLEN], fname[MAXPATHLEN];
+  int signum;
+
+  sigemptyset (pending);
+  sigemptyset (blocked);
+  sigemptyset (ignored);
+  sprintf (fname, "/proc/%d/status", pid);
+  procfile = fopen (fname, "r");
+  if (procfile == NULL)
+    error ("Could not open %s", fname);
+
+  while (fgets (buffer, MAXPATHLEN, procfile) != NULL)
+    {
+      /* Normal queued signals are on the SigPnd line in the status
+	 file.  However, 2.6 kernels also have a "shared" pending queue
+	 for delivering signals to a thread group, so check for a ShdPnd
+	 line also.
+
+	 Unfortunately some Red Hat kernels include the shared pending queue
+	 but not the ShdPnd status field.  */
+
+      if (strncmp (buffer, "SigPnd:\t", 8) == 0)
+	linux_proc_add_line_to_sigset (buffer + 8, pending);
+      else if (strncmp (buffer, "ShdPnd:\t", 8) == 0)
+	linux_proc_add_line_to_sigset (buffer + 8, pending);
+      else if (strncmp (buffer, "SigBlk:\t", 8) == 0)
+	linux_proc_add_line_to_sigset (buffer + 8, blocked);
+      else if (strncmp (buffer, "SigIgn:\t", 8) == 0)
+	linux_proc_add_line_to_sigset (buffer + 8, ignored);
+    }
+
+  fclose (procfile);
+}
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
deleted file mode 100644
index 7b35087..0000000
--- a/gdb/m32r-linux-nat.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Native-dependent code for GNU/Linux m32r.
-
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "inferior.h"
-#include "gdbcore.h"
-#include "regcache.h"
-#include "linux-nat.h"
-
-#include "gdb_assert.h"
-#include "gdb_string.h"
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <sys/procfs.h>
-
-/* Prototypes for supply_gregset etc.  */
-#include "gregset.h"
-
-#include "m32r-tdep.h"
-
-
-
-
-/* Since EVB register is not available for native debug, we reduce
-   the number of registers.  */
-#define M32R_LINUX_NUM_REGS (M32R_NUM_REGS - 1)
-
-/* Mapping between the general-purpose registers in `struct user'
-   format and GDB's register array layout.  */
-static int regmap[] = {
-  4, 5, 6, 7, 0, 1, 2, 8,
-  9, 10, 11, 12, 13, 24, 25, 23,
-  19, 19, 26, 23, 22, 20, 16, 15
-};
-
-#define PSW_REGMAP 19
-#define BBPSW_REGMAP 21
-#define SPU_REGMAP 23
-#define SPI_REGMAP 26
-
-/* Doee apply to the corresponding SET requests as well.  */
-#define GETREGS_SUPPLIES(regno) (0 <= (regno) && (regno) <= M32R_LINUX_NUM_REGS)
-
-
-
-/* Transfering the general-purpose registers between GDB, inferiors
-   and core files.  */
-
-/* Fill GDB's register array with the general-purpose register values
-   in *GREGSETP.  */
-
-void
-supply_gregset (elf_gregset_t * gregsetp)
-{
-  elf_greg_t *regp = (elf_greg_t *) gregsetp;
-  int i;
-  unsigned long psw, bbpsw;
-
-  psw = *(regp + PSW_REGMAP);
-  bbpsw = *(regp + BBPSW_REGMAP);
-
-  for (i = 0; i < M32R_LINUX_NUM_REGS; i++)
-    {
-      switch (i)
-	{
-	case PSW_REGNUM:
-	  *(regp + regmap[i]) =
-	    ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
-	  break;
-	case CBR_REGNUM:
-	  *(regp + regmap[i]) = ((psw >> 8) & 1);
-	  break;
-	}
-
-      if (i != M32R_SP_REGNUM)
-	regcache_raw_supply (current_regcache, i, regp + regmap[i]);
-      else if (psw & 0x8000)
-	regcache_raw_supply (current_regcache, i, regp + SPU_REGMAP);
-      else
-	regcache_raw_supply (current_regcache, i, regp + SPI_REGMAP);
-    }
-}
-
-/* Fetch all general-purpose registers from process/thread TID and
-   store their values in GDB's register array.  */
-
-static void
-fetch_regs (int tid)
-{
-  elf_gregset_t regs;
-
-  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
-    perror_with_name ("Couldn't get registers");
-
-  supply_gregset (&regs);
-}
-
-/* Fill register REGNO (if it is a general-purpose register) in
-   *GREGSETPS with the value in GDB's register array.  If REGNO is -1,
-   do this for all registers.  */
-
-void
-fill_gregset (elf_gregset_t * gregsetp, int regno)
-{
-  elf_greg_t *regp = (elf_greg_t *) gregsetp;
-  int i;
-  unsigned long psw, bbpsw, tmp;
-
-  psw = *(regp + PSW_REGMAP);
-  bbpsw = *(regp + BBPSW_REGMAP);
-
-  for (i = 0; i < M32R_LINUX_NUM_REGS; i++)
-    {
-      if (regno != -1 && regno != i)
-	continue;
-
-      if (i == CBR_REGNUM || i == PSW_REGNUM)
-	continue;
-
-      if (i == SPU_REGNUM || i == SPI_REGNUM)
-	continue;
-
-      if (i != M32R_SP_REGNUM)
-	regcache_raw_collect (current_regcache, i, regp + regmap[i]);
-      else if (psw & 0x8000)
-	regcache_raw_collect (current_regcache, i, regp + SPU_REGMAP);
-      else
-	regcache_raw_collect (current_regcache, i, regp + SPI_REGMAP);
-    }
-}
-
-/* Store all valid general-purpose registers in GDB's register array
-   into the process/thread specified by TID.  */
-
-static void
-store_regs (int tid, int regno)
-{
-  elf_gregset_t regs;
-
-  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
-    perror_with_name ("Couldn't get registers");
-
-  fill_gregset (&regs, regno);
-
-  if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
-    perror_with_name ("Couldn't write registers");
-}
-
-
-
-/* Transfering floating-point registers between GDB, inferiors and cores.  
-   Since M32R has no floating-point registers, these functions do nothing.  */
-
-void
-supply_fpregset (gdb_fpregset_t *fpregs)
-{
-}
-
-void
-fill_fpregset (gdb_fpregset_t *fpregs, int regno)
-{
-}
-
-
-
-/* Transferring arbitrary registers between GDB and inferior.  */
-
-/* Fetch register REGNO from the child process.  If REGNO is -1, do
-   this for all registers (including the floating point and SSE
-   registers).  */
-
-void
-fetch_inferior_registers (int regno)
-{
-  int tid;
-
-  /* GNU/Linux LWP ID's are process ID's.  */
-  tid = TIDGET (inferior_ptid);
-  if (tid == 0)
-    tid = PIDGET (inferior_ptid);	/* Not a threaded program.  */
-
-  /* Use the PTRACE_GETREGS request whenever possible, since it
-     transfers more registers in one system call, and we'll cache the
-     results.  */
-  if (regno == -1 || GETREGS_SUPPLIES (regno))
-    {
-      fetch_regs (tid);
-      return;
-    }
-
-  internal_error (__FILE__, __LINE__,
-		  "Got request for bad register number %d.", regno);
-}
-
-/* Store register REGNO back into the child process.  If REGNO is -1,
-   do this for all registers (including the floating point and SSE
-   registers).  */
-void
-store_inferior_registers (int regno)
-{
-  int tid;
-
-  /* GNU/Linux LWP ID's are process ID's.  */
-  if ((tid = TIDGET (inferior_ptid)) == 0)
-    tid = PIDGET (inferior_ptid);	/* Not a threaded program.  */
-
-  /* Use the PTRACE_SETREGS request whenever possible, since it
-     transfers more registers in one system call.  */
-  if (regno == -1 || GETREGS_SUPPLIES (regno))
-    {
-      store_regs (tid, regno);
-      return;
-    }
-
-  internal_error (__FILE__, __LINE__,
-		  "Got request to store bad register number %d.", regno);
-}
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
deleted file mode 100644
index d2ca1a9..0000000
--- a/gdb/m32r-linux-tdep.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* Target-dependent code for GNU/Linux m32r.
-
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "frame.h"
-#include "value.h"
-#include "regcache.h"
-#include "inferior.h"
-#include "osabi.h"
-#include "reggroups.h"
-
-#include "gdb_string.h"
-
-#include "glibc-tdep.h"
-#include "solib-svr4.h"
-
-#include "trad-frame.h"
-#include "frame-unwind.h"
-
-#include "m32r-tdep.h"
-
-
-/* Recognizing signal handler frames.  */
-
-/* GNU/Linux has two flavors of signals.  Normal signal handlers, and
-   "realtime" (RT) signals.  The RT signals can provide additional
-   information to the signal handler if the SA_SIGINFO flag is set
-   when establishing a signal handler using `sigaction'.  It is not
-   unlikely that future versions of GNU/Linux will support SA_SIGINFO
-   for normal signals too.  */
-
-/* When the m32r Linux kernel calls a signal handler and the
-   SA_RESTORER flag isn't set, the return address points to a bit of
-   code on the stack.  This function returns whether the PC appears to
-   be within this bit of code.
-
-   The instruction sequence for normal signals is
-       ldi    r7, #__NR_sigreturn
-       trap   #2
-   or 0x67 0x77 0x10 0xf2.
-
-   Checking for the code sequence should be somewhat reliable, because
-   the effect is to call the system call sigreturn.  This is unlikely
-   to occur anywhere other than in a signal trampoline.
-
-   It kind of sucks that we have to read memory from the process in
-   order to identify a signal trampoline, but there doesn't seem to be
-   any other way.  Therefore we only do the memory reads if no
-   function name could be identified, which should be the case since
-   the code is on the stack.
-
-   Detection of signal trampolines for handlers that set the
-   SA_RESTORER flag is in general not possible.  Unfortunately this is
-   what the GNU C Library has been doing for quite some time now.
-   However, as of version 2.1.2, the GNU C Library uses signal
-   trampolines (named __restore and __restore_rt) that are identical
-   to the ones used by the kernel.  Therefore, these trampolines are
-   supported too.  */
-
-static const unsigned char linux_sigtramp_code[] = {
-  0x67, 0x77, 0x10, 0xf2,
-};
-
-/* If PC is in a sigtramp routine, return the address of the start of
-   the routine.  Otherwise, return 0.  */
-
-static CORE_ADDR
-m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
-{
-  unsigned char buf[4];
-
-  /* We only recognize a signal trampoline if PC is at the start of
-     one of the instructions.  We optimize for finding the PC at the
-     start of the instruction sequence, as will be the case when the
-     trampoline is not the first frame on the stack.  We assume that
-     in the case where the PC is not at the start of the instruction
-     sequence, there will be a few trailing readable bytes on the
-     stack.  */
-
-  if (pc % 2 != 0)
-    {
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, 2))
-	return 0;
-
-      if (memcmp (buf, linux_sigtramp_code, 2) == 0)
-	pc -= 2;
-      else
-	return 0;
-    }
-
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
-    return 0;
-
-  if (memcmp (buf, linux_sigtramp_code, 4) != 0)
-    return 0;
-
-  return pc;
-}
-
-/* This function does the same for RT signals.  Here the instruction
-   sequence is
-       ldi    r7, #__NR_rt_sigreturn
-       trap   #2
-   or 0x97 0xf0 0x00 0xad 0x10 0xf2 0xf0 0x00.
-
-   The effect is to call the system call rt_sigreturn.  */
-
-static const unsigned char linux_rt_sigtramp_code[] = {
-  0x97, 0xf0, 0x00, 0xad, 0x10, 0xf2, 0xf0, 0x00,
-};
-
-/* If PC is in a RT sigtramp routine, return the address of the start
-   of the routine.  Otherwise, return 0.  */
-
-static CORE_ADDR
-m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
-{
-  unsigned char buf[4];
-
-  /* We only recognize a signal trampoline if PC is at the start of
-     one of the instructions.  We optimize for finding the PC at the
-     start of the instruction sequence, as will be the case when the
-     trampoline is not the first frame on the stack.  We assume that
-     in the case where the PC is not at the start of the instruction
-     sequence, there will be a few trailing readable bytes on the
-     stack.  */
-
-  if (pc % 2 != 0)
-    return 0;
-
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
-    return 0;
-
-  if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
-    {
-      if (!safe_frame_unwind_memory (next_frame, pc + 4, buf, 4))
-	return 0;
-
-      if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
-	return pc;
-    }
-  else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
-    {
-      if (!safe_frame_unwind_memory (next_frame, pc - 4, buf, 4))
-	return 0;
-
-      if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
-	return pc - 4;
-    }
-
-  return 0;
-}
-
-static int
-m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
-			   struct frame_info *next_frame)
-{
-  /* If we have NAME, we can optimize the search.  The trampolines are
-     named __restore and __restore_rt.  However, they aren't dynamically
-     exported from the shared C library, so the trampoline may appear to
-     be part of the preceding function.  This should always be sigaction,
-     __sigaction, or __libc_sigaction (all aliases to the same function).  */
-  if (name == NULL || strstr (name, "sigaction") != NULL)
-    return (m32r_linux_sigtramp_start (pc, next_frame) != 0
-	    || m32r_linux_rt_sigtramp_start (pc, next_frame) != 0);
-
-  return (strcmp ("__restore", name) == 0
-	  || strcmp ("__restore_rt", name) == 0);
-}
-
-/* From <asm/sigcontext.h>.  */
-static int m32r_linux_sc_reg_offset[] = {
-  4 * 4,			/* r0 */
-  5 * 4,			/* r1 */
-  6 * 4,			/* r2 */
-  7 * 4,			/* r3 */
-  0 * 4,			/* r4 */
-  1 * 4,			/* r5 */
-  2 * 4,			/* r6 */
-  8 * 4,			/* r7 */
-  9 * 4,			/* r8 */
-  10 * 4,			/* r9 */
-  11 * 4,			/* r10 */
-  12 * 4,			/* r11 */
-  13 * 4,			/* r12 */
-  21 * 4,			/* fp */
-  22 * 4,			/* lr */
-  -1 * 4,			/* sp */
-  16 * 4,			/* psw */
-  -1 * 4,			/* cbr */
-  23 * 4,			/* spi */
-  20 * 4,			/* spu */
-  19 * 4,			/* bpc */
-  17 * 4,			/* pc */
-  15 * 4,			/* accl */
-  14 * 4			/* acch */
-};
-
-struct m32r_frame_cache
-{
-  CORE_ADDR base, pc;
-  struct trad_frame_saved_reg *saved_regs;
-};
-
-static struct m32r_frame_cache *
-m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
-				 void **this_cache)
-{
-  struct m32r_frame_cache *cache;
-  CORE_ADDR sigcontext_addr, addr;
-  int regnum;
-
-  if ((*this_cache) != NULL)
-    return (*this_cache);
-  cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
-  (*this_cache) = cache;
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
-  cache->base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
-  sigcontext_addr = cache->base + 4;
-
-  cache->pc = frame_pc_unwind (next_frame);
-  addr = m32r_linux_sigtramp_start (cache->pc, next_frame);
-  if (addr == 0)
-    {
-      /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
-         accordingly.  */
-      addr = m32r_linux_rt_sigtramp_start (cache->pc, next_frame);
-      if (addr)
-	sigcontext_addr += 128;
-      else
-	addr = frame_func_unwind (next_frame);
-    }
-  cache->pc = addr;
-
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
-  for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
-    {
-      if (m32r_linux_sc_reg_offset[regnum] >= 0)
-	cache->saved_regs[regnum].addr =
-	  sigcontext_addr + m32r_linux_sc_reg_offset[regnum];
-    }
-
-  return cache;
-}
-
-static void
-m32r_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
-				   void **this_cache,
-				   struct frame_id *this_id)
-{
-  struct m32r_frame_cache *cache =
-    m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
-
-  (*this_id) = frame_id_build (cache->base, cache->pc);
-}
-
-static void
-m32r_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
-					 void **this_cache,
-					 int regnum, int *optimizedp,
-					 enum lval_type *lvalp,
-					 CORE_ADDR *addrp,
-					 int *realnump, void *valuep)
-{
-  struct m32r_frame_cache *cache =
-    m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
-
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
-}
-
-static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
-  SIGTRAMP_FRAME,
-  m32r_linux_sigtramp_frame_this_id,
-  m32r_linux_sigtramp_frame_prev_register
-};
-
-static const struct frame_unwind *
-m32r_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (m32r_linux_pc_in_sigtramp (pc, name, next_frame))
-    return &m32r_linux_sigtramp_frame_unwind;
-
-  return NULL;
-}
-
-static void
-m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  /* Since EVB register is not available for native debug, we reduce
-     the number of registers.  */
-  set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
-
-  frame_unwind_append_sniffer (gdbarch, m32r_linux_sigtramp_frame_sniffer);
-
-  /* GNU/Linux uses SVR4-style shared libraries.  */
-  set_solib_svr4_fetch_link_map_offsets
-    (gdbarch, svr4_ilp32_fetch_link_map_offsets);
-}
-
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-extern void _initialize_m32r_linux_tdep (void);
-
-void
-_initialize_m32r_linux_tdep (void)
-{
-  gdbarch_register_osabi (bfd_arch_m32r, 0, GDB_OSABI_LINUX,
-			  m32r_linux_init_abi);
-}
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 0afd261..fd5e9dc 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -1,6 +1,6 @@
 /* Target-dependent code for Renesas M32R, for GDB.
 
-   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -41,7 +41,27 @@
 
 #include "gdb_assert.h"
 
-#include "m32r-tdep.h"
+struct gdbarch_tdep
+{
+  /* gdbarch target dependent data here. Currently unused for M32R. */
+};
+
+/* m32r register names. */
+
+enum
+{
+  R0_REGNUM = 0,
+  R3_REGNUM = 3,
+  M32R_FP_REGNUM = 13,
+  LR_REGNUM = 14,
+  M32R_SP_REGNUM = 15,
+  PSW_REGNUM = 16,
+  M32R_PC_REGNUM = 21,
+  /* m32r calling convention. */
+  ARG1_REGNUM = R0_REGNUM,
+  ARGN_REGNUM = R3_REGNUM,
+  RET1_REGNUM = R0_REGNUM,
+};
 
 /* Local functions */
 
@@ -55,6 +75,19 @@
   return sp & ~3;
 }
 
+/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of
+   EXTRACT_RETURN_VALUE?  GCC_P is true if compiled with gcc and TYPE
+   is the type (which is known to be struct, union or array).
+
+   The m32r returns anything less than 8 bytes in size in
+   registers. */
+
+static int
+m32r_use_struct_convention (int gcc_p, struct type *type)
+{
+  return (TYPE_LENGTH (type) > 8);
+}
+
 
 /* BREAKPOINT */
 #define M32R_BE_BREAKPOINT32 {0x10, 0xf1, 0x70, 0x00}
@@ -205,12 +238,18 @@
   "evb"
 };
 
+static int
+m32r_num_regs (void)
+{
+  return (sizeof (m32r_register_names) / sizeof (m32r_register_names[0]));
+}
+
 static const char *
 m32r_register_name (int reg_nr)
 {
   if (reg_nr < 0)
     return NULL;
-  if (reg_nr >= M32R_NUM_REGS)
+  if (reg_nr >= m32r_num_regs ())
     return NULL;
   return m32r_register_names[reg_nr];
 }
@@ -253,56 +292,69 @@
     }
 }
 
+/* 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).  */
+
+static CORE_ADDR
+m32r_extract_struct_value_address (struct regcache *regcache)
+{
+  ULONGEST addr;
+  regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &addr);
+  return addr;
+}
+
+
 /* This is required by skip_prologue. The results of decoding a prologue
    should be cached because this thrashing is getting nuts.  */
 
-static int
+static void
 decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
-		 CORE_ADDR *pl_endptr, unsigned long *framelength)
+		 CORE_ADDR *pl_endptr)
 {
   unsigned long framesize;
   int insn;
   int op1;
+  int maybe_one_more = 0;
   CORE_ADDR after_prologue = 0;
-  CORE_ADDR after_push = 0;
   CORE_ADDR after_stack_adjust = 0;
   CORE_ADDR current_pc;
-  LONGEST return_value;
 
   framesize = 0;
   after_prologue = 0;
 
   for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
     {
-      /* Check if current pc's location is readable. */
-      if (!safe_read_memory_integer (current_pc, 2, &return_value))
-	return -1;
-
       insn = read_memory_unsigned_integer (current_pc, 2);
 
-      if (insn == 0x0000)
-	break;
-
       /* If this is a 32 bit instruction, we dont want to examine its
          immediate data as though it were an instruction */
       if (current_pc & 0x02)
 	{
+	  /* Clear the parallel execution bit from 16 bit instruction */
+	  if (maybe_one_more)
+	    {
+	      /* The last instruction was a branch, usually terminates
+	         the series, but if this is a parallel instruction,
+	         it may be a stack framing instruction */
+	      if (!(insn & 0x8000))
+		{
+		  /* nope, we are really done */
+		  break;
+		}
+	    }
 	  /* decode this instruction further */
 	  insn &= 0x7fff;
 	}
       else
 	{
+	  if (maybe_one_more)
+	    break;		/* This isnt the one more */
 	  if (insn & 0x8000)
 	    {
 	      if (current_pc == scan_limit)
 		scan_limit += 2;	/* extend the search */
-
 	      current_pc += 2;	/* skip the immediate data */
-
-	      /* Check if current pc's location is readable. */
-	      if (!safe_read_memory_integer (current_pc, 2, &return_value))
-		return -1;
-
 	      if (insn == 0x8faf)	/* add3 sp, sp, xxxx */
 		/* add 16 bit sign-extended offset */
 		{
@@ -312,8 +364,6 @@
 	      else
 		{
 		  if (((insn >> 8) == 0xe4)	/* ld24 r4, xxxxxx; sub sp, r4 */
-		      && safe_read_memory_integer (current_pc + 2, 2,
-						   &return_value)
 		      && read_memory_unsigned_integer (current_pc + 2,
 						       2) == 0x0f24)
 		    /* subtract 24 bit sign-extended negative-offset */
@@ -326,7 +376,7 @@
 		      framesize += insn;
 		    }
 		}
-	      after_push = current_pc + 2;
+	      after_prologue = current_pc;
 	      continue;
 	    }
 	}
@@ -365,23 +415,17 @@
 	  after_prologue = current_pc + 2;
 	  break;		/* end of stack adjustments */
 	}
-
       /* Nop looks like a branch, continue explicitly */
       if (insn == 0x7000)
 	{
 	  after_prologue = current_pc + 2;
 	  continue;		/* nop occurs between pushes */
 	}
-      /* End of prolog if any of these are trap instructions */
-      if ((insn & 0xfff0) == 0x10f0)
-	{
-	  after_prologue = current_pc;
-	  break;
-	}
       /* End of prolog if any of these are branch instructions */
       if ((op1 == 0x7000) || (op1 == 0xb000) || (op1 == 0xf000))
 	{
 	  after_prologue = current_pc;
+	  maybe_one_more = 1;
 	  continue;
 	}
       /* Some of the branch instructions are mixed with other types */
@@ -391,14 +435,12 @@
 	  if ((subop == 0x0ec0) || (subop == 0x0fc0))
 	    {
 	      after_prologue = current_pc;
+	      maybe_one_more = 1;
 	      continue;		/* jmp , jl */
 	    }
 	}
     }
 
-  if (framelength)
-    *framelength = framesize;
-
   if (current_pc >= scan_limit)
     {
       if (pl_endptr)
@@ -410,13 +452,6 @@
 	    {
 	      *pl_endptr = after_stack_adjust;
 	    }
-	  else if (after_push != 0)
-	    /* We did not find a "mv fp,sp", but we DID find
-	       a push.  Is it safe to use that as the
-	       end of the prologue?  I just don't know. */
-	    {
-	      *pl_endptr = after_push;
-	    }
 	  else
 	    /* We reached the end of the loop without finding the end
 	       of the prologue.  No way to win -- we should report failure.  
@@ -424,29 +459,25 @@
 	       GDB will set a breakpoint at the start of the function (etc.) */
 	    *pl_endptr = start_pc;
 	}
-      return 0;
+      return;
     }
-
   if (after_prologue == 0)
     after_prologue = current_pc;
 
   if (pl_endptr)
     *pl_endptr = after_prologue;
-
-  return 0;
 }				/*  decode_prologue */
 
 /* Function: skip_prologue
    Find end of function prologue */
 
-#define DEFAULT_SEARCH_LIMIT 128
+#define DEFAULT_SEARCH_LIMIT 44
 
 CORE_ADDR
 m32r_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end;
   struct symtab_and_line sal;
-  LONGEST return_value;
 
   /* See what the symbol table says */
 
@@ -468,18 +499,11 @@
     }
   else
     func_end = pc + DEFAULT_SEARCH_LIMIT;
-
-  /* If pc's location is not readable, just quit. */
-  if (!safe_read_memory_integer (pc, 4, &return_value))
-    return pc;
-
-  /* Find the end of prologue.  */
-  if (decode_prologue (pc, func_end, &sal.end, NULL) < 0)
-    return pc;
-
+  decode_prologue (pc, func_end, &sal.end);
   return sal.end;
 }
 
+
 struct m32r_unwind_cache
 {
   /* The previous frame's inner most stack address.  Used as this
@@ -508,14 +532,13 @@
 m32r_frame_unwind_cache (struct frame_info *next_frame,
 			 void **this_prologue_cache)
 {
-  CORE_ADDR pc, scan_limit;
+  CORE_ADDR pc;
   ULONGEST prev_sp;
   ULONGEST this_base;
-  unsigned long op, op2;
+  unsigned long op;
   int i;
   struct m32r_unwind_cache *info;
 
-
   if ((*this_prologue_cache))
     return (*this_prologue_cache);
 
@@ -525,11 +548,10 @@
 
   info->size = 0;
   info->sp_offset = 0;
-  info->uses_frame = 0;
 
-  scan_limit = frame_pc_unwind (next_frame);
+  info->uses_frame = 0;
   for (pc = frame_func_unwind (next_frame);
-       pc > 0 && pc < scan_limit; pc += 2)
+       pc > 0 && pc < frame_pc_unwind (next_frame); pc += 2)
     {
       if ((pc & 2) == 0)
 	{
@@ -543,19 +565,18 @@
 		  short n = op & 0xffff;
 		  info->sp_offset += n;
 		}
-	      else if (((op >> 8) == 0xe4)
-		       && get_frame_memory_unsigned (next_frame, pc + 2,
+	      else if (((op >> 8) == 0xe4)	/* ld24 r4, xxxxxx; sub sp, r4 */
+		       && get_frame_memory_unsigned (next_frame, pc + 4,
 						     2) == 0x0f24)
 		{
-		  /* ld24 r4, xxxxxx; sub sp, r4 */
 		  unsigned long n = op & 0xffffff;
 		  info->sp_offset += n;
-		  pc += 2;	/* skip sub instruction */
+		  pc += 2;
 		}
+	      else
+		break;
 
-	      if (pc == scan_limit)
-		scan_limit += 2;	/* extend the search */
-	      pc += 2;		/* skip the immediate data */
+	      pc += 2;
 	      continue;
 	    }
 	}
@@ -580,13 +601,12 @@
 	  /* mv fp, sp */
 	  info->uses_frame = 1;
 	  info->r13_offset = info->sp_offset;
-	  break;		/* end of stack adjustments */
 	}
-      else if ((op & 0xfff0) == 0x10f0)
-	{
-	  /* end of prologue if this is a trap instruction */
-	  break;		/* end of stack adjustments */
-	}
+      else if (op == 0x7000)
+	/* nop */
+	continue;
+      else
+	break;
     }
 
   info->size = -info->sp_offset;
@@ -787,24 +807,6 @@
     }
 }
 
-enum return_value_convention
-m32r_return_value (struct gdbarch *gdbarch, struct type *valtype,
-		   struct regcache *regcache, void *readbuf,
-		   const void *writebuf)
-{
-  if (TYPE_LENGTH (valtype) > 8)
-    return RETURN_VALUE_STRUCT_CONVENTION;
-  else
-    {
-      if (readbuf != NULL)
-	m32r_extract_return_value (valtype, regcache, readbuf);
-      if (writebuf != NULL)
-	m32r_store_return_value (valtype, regcache, writebuf);
-      return RETURN_VALUE_REGISTER_CONVENTION;
-    }
-}
-
-
 
 static CORE_ADDR
 m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -919,13 +921,16 @@
   set_gdbarch_write_pc (gdbarch, m32r_write_pc);
   set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
 
-  set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
+  set_gdbarch_num_regs (gdbarch, m32r_num_regs ());
   set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
   set_gdbarch_register_name (gdbarch, m32r_register_name);
   set_gdbarch_register_type (gdbarch, m32r_register_type);
 
+  set_gdbarch_extract_return_value (gdbarch, m32r_extract_return_value);
   set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call);
-  set_gdbarch_return_value (gdbarch, m32r_return_value);
+  set_gdbarch_store_return_value (gdbarch, m32r_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m32r_extract_struct_value_address);
+  set_gdbarch_deprecated_use_struct_convention (gdbarch, m32r_use_struct_convention);
 
   set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/m32r-tdep.h b/gdb/m32r-tdep.h
deleted file mode 100644
index 60da0d6..0000000
--- a/gdb/m32r-tdep.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Target-dependent code for Renesas M32R, for GDB.
- 
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#ifndef M32R_TDEP_H
-#define M32R_TDEP_H
-
-struct gdbarch_tdep
-{
-  /* gdbarch target dependent data here. Currently unused for M32R. */
-};
-
-/* m32r register names. */
-
-enum m32r_regnum
-{
-  R0_REGNUM = 0,
-  R3_REGNUM = 3,
-  M32R_FP_REGNUM = 13,
-  LR_REGNUM = 14,
-  M32R_SP_REGNUM = 15,
-  PSW_REGNUM = 16,
-  CBR_REGNUM = 17,
-  SPU_REGNUM = 18,
-  SPI_REGNUM = 19,
-  M32R_PC_REGNUM = 21,
-  /* m32r calling convention. */
-  ARG1_REGNUM = R0_REGNUM,
-  ARGN_REGNUM = R3_REGNUM,
-  RET1_REGNUM = R0_REGNUM,
-};
-
-#define M32R_NUM_REGS 25
-
-#endif /* m32r-tdep.h */
diff --git a/gdb/m88kbsd-nat.c b/gdb/m88kbsd-nat.c
index 472eb76..7553c19 100644
--- a/gdb/m88kbsd-nat.c
+++ b/gdb/m88kbsd-nat.c
@@ -22,14 +22,12 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
-#include "target.h"
 
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <machine/reg.h>
 
 #include "m88k-tdep.h"
-#include "inf-ptrace.h"
 
 /* Supply the general-purpose registers stored in GREGS to REGCACHE.  */
 
@@ -64,8 +62,8 @@
 /* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
    for all registers.  */
 
-static void
-m88kbsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
 {
   struct reg regs;
 
@@ -79,8 +77,8 @@
 /* Store register REGNUM back into the inferior.  If REGNUM is -1, do
    this for all registers.  */
 
-static void
-m88kbsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
 {
   struct reg regs;
 
@@ -94,18 +92,3 @@
 	      (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name ("Couldn't write registers");
 }
-
-
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-void _initialize_m88kbsd_nat (void);
-
-void
-_initialize_m88kbsd_nat (void)
-{
-  struct target_ops *t;
-
-  t = inf_ptrace_target ();
-  t->to_fetch_registers = m88kbsd_fetch_inferior_registers;
-  t->to_store_registers = m88kbsd_store_inferior_registers;
-  add_target (t);
-}
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4f249b8..e9dc623 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -945,6 +945,63 @@
   return 0;
 }
 
+/* Decode a MIPS32 instruction that saves a register in the stack, and
+   set the appropriate bit in the general register mask or float register mask
+   to indicate which register is saved.  This is a helper function
+   for mips_find_saved_regs.  */
+
+static void
+mips32_decode_reg_save (t_inst inst, unsigned long *gen_mask,
+			unsigned long *float_mask)
+{
+  int reg;
+
+  if ((inst & 0xffe00000) == 0xafa00000	/* sw reg,n($sp) */
+      || (inst & 0xffe00000) == 0xafc00000	/* sw reg,n($r30) */
+      || (inst & 0xffe00000) == 0xffa00000)	/* sd reg,n($sp) */
+    {
+      /* It might be possible to use the instruction to
+         find the offset, rather than the code below which
+         is based on things being in a certain order in the
+         frame, but figuring out what the instruction's offset
+         is relative to might be a little tricky.  */
+      reg = (inst & 0x001f0000) >> 16;
+      *gen_mask |= (1 << reg);
+    }
+  else if ((inst & 0xffe00000) == 0xe7a00000	/* swc1 freg,n($sp) */
+	   || (inst & 0xffe00000) == 0xe7c00000	/* swc1 freg,n($r30) */
+	   || (inst & 0xffe00000) == 0xf7a00000)	/* sdc1 freg,n($sp) */
+
+    {
+      reg = ((inst & 0x001f0000) >> 16);
+      *float_mask |= (1 << reg);
+    }
+}
+
+/* Decode a MIPS16 instruction that saves a register in the stack, and
+   set the appropriate bit in the general register or float register mask
+   to indicate which register is saved.  This is a helper function
+   for mips_find_saved_regs.  */
+
+static void
+mips16_decode_reg_save (t_inst inst, unsigned long *gen_mask)
+{
+  if ((inst & 0xf800) == 0xd000)	/* sw reg,n($sp) */
+    {
+      int reg = mips16_to_32_reg[(inst & 0x700) >> 8];
+      *gen_mask |= (1 << reg);
+    }
+  else if ((inst & 0xff00) == 0xf900)	/* sd reg,n($sp) */
+    {
+      int reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+      *gen_mask |= (1 << reg);
+    }
+  else if ((inst & 0xff00) == 0x6200	/* sw $ra,n($sp) */
+	   || (inst & 0xff00) == 0xfa00)	/* sd $ra,n($sp) */
+    *gen_mask |= (1 << RA_REGNUM);
+}
+
+
 /* Fetch and return instruction from the specified location.  If the PC
    is odd, assume it's a MIPS16 instruction; otherwise MIPS32.  */
 
@@ -983,6 +1040,20 @@
   return extract_unsigned_integer (buf, instlen);
 }
 
+static ULONGEST
+mips32_fetch_instruction (CORE_ADDR addr)
+{
+  char buf[MIPS_INSTLEN];
+  int instlen;
+  int status;
+  instlen = MIPS_INSTLEN;
+  status = deprecated_read_memory_nobpt (addr, buf, instlen);
+  if (status)
+    memory_error (status, addr);
+  return extract_unsigned_integer (buf, instlen);
+}
+
+
 /* These the fields of 32 bit mips instructions */
 #define mips32_op(x) (x >> 26)
 #define itype_op(x) (x >> 26)
@@ -1143,7 +1214,7 @@
 	    pc += 8;
 	  break;
 	case 6:		/* BLEZ, BLEZL */
-	  if (read_signed_register (itype_rs (inst)) <= 0)
+	  if (read_signed_register (itype_rs (inst) <= 0))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
@@ -1151,7 +1222,7 @@
 	case 7:
 	default:
 	greater_branch:	/* BGTZ, BGTZL */
-	  if (read_signed_register (itype_rs (inst)) > 0)
+	  if (read_signed_register (itype_rs (inst) > 0))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
@@ -1710,262 +1781,6 @@
     return NULL;
 }
 
-/* Set a register's saved stack address in temp_saved_regs.  If an
-   address has already been set for this register, do nothing; this
-   way we will only recognize the first save of a given register in a
-   function prologue.
-
-   For simplicity, save the address in both [0 .. NUM_REGS) and
-   [NUM_REGS .. 2*NUM_REGS).  Strictly speaking, only the second range
-   is used as it is only second range (the ABI instead of ISA
-   registers) that comes into play when finding saved registers in a
-   frame.  */
-
-static void
-set_reg_offset (struct mips_frame_cache *this_cache, int regnum,
-		CORE_ADDR offset)
-{
-  if (this_cache != NULL
-      && this_cache->saved_regs[regnum].addr == -1)
-    {
-      this_cache->saved_regs[regnum + 0 * NUM_REGS].addr = offset;
-      this_cache->saved_regs[regnum + 1 * NUM_REGS].addr = offset;
-    }
-}
-
-
-/* Fetch the immediate value from a MIPS16 instruction.
-   If the previous instruction was an EXTEND, use it to extend
-   the upper bits of the immediate value.  This is a helper function
-   for mips16_scan_prologue.  */
-
-static int
-mips16_get_imm (unsigned short prev_inst,	/* previous instruction */
-		unsigned short inst,	/* current instruction */
-		int nbits,	/* number of bits in imm field */
-		int scale,	/* scale factor to be applied to imm */
-		int is_signed)	/* is the imm field signed? */
-{
-  int offset;
-
-  if ((prev_inst & 0xf800) == 0xf000)	/* prev instruction was EXTEND? */
-    {
-      offset = ((prev_inst & 0x1f) << 11) | (prev_inst & 0x7e0);
-      if (offset & 0x8000)	/* check for negative extend */
-	offset = 0 - (0x10000 - (offset & 0xffff));
-      return offset | (inst & 0x1f);
-    }
-  else
-    {
-      int max_imm = 1 << nbits;
-      int mask = max_imm - 1;
-      int sign_bit = max_imm >> 1;
-
-      offset = inst & mask;
-      if (is_signed && (offset & sign_bit))
-	offset = 0 - (max_imm - offset);
-      return offset * scale;
-    }
-}
-
-
-/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
-   the associated FRAME_CACHE if not null.
-   Return the address of the first instruction past the prologue.  */
-
-static CORE_ADDR
-mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                      struct frame_info *next_frame,
-                      struct mips_frame_cache *this_cache)
-{
-  CORE_ADDR cur_pc;
-  CORE_ADDR frame_addr = 0;	/* Value of $r17, used as frame pointer */
-  CORE_ADDR sp;
-  long frame_offset = 0;        /* Size of stack frame.  */
-  long frame_adjust = 0;        /* Offset of FP from SP.  */
-  int frame_reg = MIPS_SP_REGNUM;
-  unsigned short prev_inst = 0;	/* saved copy of previous instruction */
-  unsigned inst = 0;		/* current instruction */
-  unsigned entry_inst = 0;	/* the entry instruction */
-  int reg, offset;
-
-  int extend_bytes = 0;
-  int prev_extend_bytes;
-  CORE_ADDR end_prologue_addr = 0;
-
-  /* Can be called when there's no process, and hence when there's no
-     NEXT_FRAME.  */
-  if (next_frame != NULL)
-    sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
-  else
-    sp = 0;
-
-  if (limit_pc > start_pc + 200)
-    limit_pc = start_pc + 200;
-
-  for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS16_INSTLEN)
-    {
-      /* Save the previous instruction.  If it's an EXTEND, we'll extract
-         the immediate offset extension from it in mips16_get_imm.  */
-      prev_inst = inst;
-
-      /* Fetch and decode the instruction.   */
-      inst = (unsigned short) mips_fetch_instruction (cur_pc);
-
-      /* Normally we ignore extend instructions.  However, if it is
-         not followed by a valid prologue instruction, then this
-         instruction is not part of the prologue either.  We must
-         remember in this case to adjust the end_prologue_addr back
-         over the extend.  */
-      if ((inst & 0xf800) == 0xf000)    /* extend */
-        {
-          extend_bytes = MIPS16_INSTLEN;
-          continue;
-        }
-
-      prev_extend_bytes = extend_bytes;
-      extend_bytes = 0;
-
-      if ((inst & 0xff00) == 0x6300	/* addiu sp */
-	  || (inst & 0xff00) == 0xfb00)	/* daddiu sp */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
-	  if (offset < 0)	/* negative stack adjustment? */
-	    frame_offset -= offset;
-	  else
-	    /* Exit loop if a positive stack adjustment is found, which
-	       usually means that the stack cleanup code in the function
-	       epilogue is reached.  */
-	    break;
-	}
-      else if ((inst & 0xf800) == 0xd000)	/* sw reg,n($sp) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
-	  reg = mips16_to_32_reg[(inst & 0x700) >> 8];
-	  set_reg_offset (this_cache, reg, sp + offset);
-	}
-      else if ((inst & 0xff00) == 0xf900)	/* sd reg,n($sp) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
-	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, sp + offset);
-	}
-      else if ((inst & 0xff00) == 0x6200)	/* sw $ra,n($sp) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
-	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
-	}
-      else if ((inst & 0xff00) == 0xfa00)	/* sd $ra,n($sp) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
-	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
-	}
-      else if (inst == 0x673d)	/* move $s1, $sp */
-	{
-	  frame_addr = sp;
-	  frame_reg = 17;
-	}
-      else if ((inst & 0xff00) == 0x0100)	/* addiu $s1,sp,n */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
-	  frame_addr = sp + offset;
-	  frame_reg = 17;
-	  frame_adjust = offset;
-	}
-      else if ((inst & 0xFF00) == 0xd900)	/* sw reg,offset($s1) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
-	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, frame_addr + offset);
-	}
-      else if ((inst & 0xFF00) == 0x7900)	/* sd reg,offset($s1) */
-	{
-	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
-	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, frame_addr + offset);
-	}
-      else if ((inst & 0xf81f) == 0xe809
-               && (inst & 0x700) != 0x700)	/* entry */
-	entry_inst = inst;	/* save for later processing */
-      else if ((inst & 0xf800) == 0x1800)	/* jal(x) */
-	cur_pc += MIPS16_INSTLEN;	/* 32-bit instruction */
-      else if ((inst & 0xff1c) == 0x6704)	/* move reg,$a0-$a3 */
-        {
-          /* This instruction is part of the prologue, but we don't
-             need to do anything special to handle it.  */
-        }
-      else
-        {
-          /* This instruction is not an instruction typically found
-             in a prologue, so we must have reached the end of the
-             prologue.  */
-          if (end_prologue_addr == 0)
-            end_prologue_addr = cur_pc - prev_extend_bytes;
-        }
-    }
-
-  /* The entry instruction is typically the first instruction in a function,
-     and it stores registers at offsets relative to the value of the old SP
-     (before the prologue).  But the value of the sp parameter to this
-     function is the new SP (after the prologue has been executed).  So we
-     can't calculate those offsets until we've seen the entire prologue,
-     and can calculate what the old SP must have been. */
-  if (entry_inst != 0)
-    {
-      int areg_count = (entry_inst >> 8) & 7;
-      int sreg_count = (entry_inst >> 6) & 3;
-
-      /* The entry instruction always subtracts 32 from the SP.  */
-      frame_offset += 32;
-
-      /* Now we can calculate what the SP must have been at the
-         start of the function prologue.  */
-      sp += frame_offset;
-
-      /* Check if a0-a3 were saved in the caller's argument save area.  */
-      for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
-	{
-	  set_reg_offset (this_cache, reg, sp + offset);
-	  offset += mips_abi_regsize (current_gdbarch);
-	}
-
-      /* Check if the ra register was pushed on the stack.  */
-      offset = -4;
-      if (entry_inst & 0x20)
-	{
-	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
-	  offset -= mips_abi_regsize (current_gdbarch);
-	}
-
-      /* Check if the s0 and s1 registers were pushed on the stack.  */
-      for (reg = 16; reg < sreg_count + 16; reg++)
-	{
-	  set_reg_offset (this_cache, reg, sp + offset);
-	  offset -= mips_abi_regsize (current_gdbarch);
-	}
-    }
-
-  if (this_cache != NULL)
-    {
-      this_cache->base =
-        (frame_unwind_register_signed (next_frame, NUM_REGS + frame_reg)
-         + frame_offset - frame_adjust);
-      /* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
-         be able to get rid of the assignment below, evetually. But it's
-         still needed for now.  */
-      this_cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
-        = this_cache->saved_regs[NUM_REGS + RA_REGNUM];
-    }
-
-  /* If we didn't reach the end of the prologue when scanning the function
-     instructions, then set end_prologue_addr to the address of the
-     instruction immediately after the last one we scanned.  */
-  if (end_prologue_addr == 0)
-    end_prologue_addr = cur_pc;
-
-  return end_prologue_addr;
-}
-
 /* Heuristic unwinder for 16-bit MIPS instruction set (aka MIPS16).
    Procedures that use the 32-bit instruction set are handled by the
    mips_insn32 unwinder.  */
@@ -1973,7 +1788,14 @@
 static struct mips_frame_cache *
 mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache)
 {
+  mips_extra_func_info_t proc_desc;
   struct mips_frame_cache *cache;
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  /* r0 bit means kernel trap */
+  int kernel_trap;
+  /* What registers have been saved?  Bitmasks.  */
+  unsigned long gen_mask, float_mask;
 
   if ((*this_cache) != NULL)
     return (*this_cache);
@@ -1981,7 +1803,7 @@
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
-  /* Analyze the function prologue.  */
+  /* Synthesize a proc descriptor.  */
   {
     const CORE_ADDR pc = frame_pc_unwind (next_frame);
     CORE_ADDR start_addr;
@@ -1989,14 +1811,166 @@
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
     if (start_addr == 0)
       start_addr = heuristic_proc_start (pc);
-    /* We can't analyze the prologue if we couldn't find the begining
-       of the function.  */
-    if (start_addr == 0)
-      return cache;
 
-    mips16_scan_prologue (start_addr, pc, next_frame, *this_cache);
+#ifdef NOT_YET
+    proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache);
+#else
+    proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, NULL);
+#endif
   }
   
+  /* Extract the frame's base.  */
+  cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc))
+		 + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc));
+
+  kernel_trap = PROC_REG_MASK (proc_desc) & 1;
+  gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc);
+  float_mask = kernel_trap ? 0xFFFFFFFF : PROC_FREG_MASK (proc_desc);
+  
+  /* In any frame other than the innermost or a frame interrupted by a
+     signal, we assume that all registers have been saved.  This
+     assumes that all register saves in a function happen before the
+     first function call.  */
+  if (in_prologue (frame_pc_unwind (next_frame), PROC_LOW_ADDR (proc_desc))
+      /* Not sure exactly what kernel_trap means, but if it means the
+	 kernel saves the registers without a prologue doing it, we
+	 better not examine the prologue to see whether registers
+	 have been saved yet.  */
+      && !kernel_trap)
+    {
+      /* We need to figure out whether the registers that the
+         proc_desc claims are saved have been saved yet.  */
+
+      CORE_ADDR addr;
+
+      /* Bitmasks; set if we have found a save for the register.  */
+      unsigned long gen_save_found = 0;
+      unsigned long float_save_found = 0;
+      int mips16;
+
+      /* If the address is odd, assume this is MIPS16 code.  */
+      addr = PROC_LOW_ADDR (proc_desc);
+      mips16 = pc_is_mips16 (addr);
+
+      /* Scan through this function's instructions preceding the
+         current PC, and look for those that save registers.  */
+      while (addr < frame_pc_unwind (next_frame))
+	{
+	  if (mips16)
+	    {
+	      mips16_decode_reg_save (mips16_fetch_instruction (addr),
+				      &gen_save_found);
+	      addr += MIPS16_INSTLEN;
+	    }
+	  else
+	    {
+	      mips32_decode_reg_save (mips32_fetch_instruction (addr),
+				      &gen_save_found, &float_save_found);
+	      addr += MIPS_INSTLEN;
+	    }
+	}
+      gen_mask = gen_save_found;
+      float_mask = float_save_found;
+    }
+
+  /* Fill in the offsets for the registers which gen_mask says were
+     saved.  */
+  {
+    CORE_ADDR reg_position = (cache->base
+			      + PROC_REG_OFFSET (proc_desc));
+    int ireg;
+    for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1)
+      if (gen_mask & 0x80000000)
+	{
+	  cache->saved_regs[NUM_REGS + ireg].addr = reg_position;
+	  reg_position -= mips_abi_regsize (gdbarch);
+	}
+  }
+
+  /* The MIPS16 entry instruction saves $s0 and $s1 in the reverse
+     order of that normally used by gcc.  Therefore, we have to fetch
+     the first instruction of the function, and if it's an entry
+     instruction that saves $s0 or $s1, correct their saved addresses.  */
+  if (pc_is_mips16 (PROC_LOW_ADDR (proc_desc)))
+    {
+      ULONGEST inst = mips16_fetch_instruction (PROC_LOW_ADDR (proc_desc));
+      if ((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700)
+	/* entry */
+	{
+	  int reg;
+	  int sreg_count = (inst >> 6) & 3;
+
+	  /* Check if the ra register was pushed on the stack.  */
+	  CORE_ADDR reg_position = (cache->base
+				    + PROC_REG_OFFSET (proc_desc));
+	  if (inst & 0x20)
+	    reg_position -= mips_abi_regsize (gdbarch);
+
+	  /* Check if the s0 and s1 registers were pushed on the
+	     stack.  */
+	  /* NOTE: cagney/2004-02-08: Huh?  This is doing no such
+             check.  */
+	  for (reg = 16; reg < sreg_count + 16; reg++)
+	    {
+	      cache->saved_regs[NUM_REGS + reg].addr = reg_position;
+	      reg_position -= mips_abi_regsize (gdbarch);
+	    }
+	}
+    }
+
+  /* Fill in the offsets for the registers which float_mask says were
+     saved.  */
+  {
+    CORE_ADDR reg_position = (cache->base
+			      + PROC_FREG_OFFSET (proc_desc));
+    int ireg;
+    /* Fill in the offsets for the float registers which float_mask
+       says were saved.  */
+    for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
+      if (float_mask & 0x80000000)
+	{
+	  if (mips_abi_regsize (gdbarch) == 4
+	      && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+	    {
+	      /* On a big endian 32 bit ABI, floating point registers
+	         are paired to form doubles such that the most
+	         significant part is in $f[N+1] and the least
+	         significant in $f[N] vis: $f[N+1] ||| $f[N].  The
+	         registers are also spilled as a pair and stored as a
+	         double.
+
+	         When little-endian the least significant part is
+	         stored first leading to the memory order $f[N] and
+	         then $f[N+1].
+
+	         Unfortunately, when big-endian the most significant
+	         part of the double is stored first, and the least
+	         significant is stored second.  This leads to the
+	         registers being ordered in memory as firt $f[N+1] and
+	         then $f[N].
+
+	         For the big-endian case make certain that the
+	         addresses point at the correct (swapped) locations
+	         $f[N] and $f[N+1] pair (keep in mind that
+	         reg_position is decremented each time through the
+	         loop).  */
+	      if ((ireg & 1))
+		cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+		  .addr = reg_position - mips_abi_regsize (gdbarch);
+	      else
+		cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+		  .addr = reg_position + mips_abi_regsize (gdbarch);
+	    }
+	  else
+	    cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
+	      .addr = reg_position;
+	  reg_position -= mips_abi_regsize (gdbarch);
+	}
+
+    cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
+      = cache->saved_regs[NUM_REGS + RA_REGNUM];
+  }
+
   /* SP_REGNUM, contains the value and not the address.  */
   trad_frame_set_value (cache->saved_regs, NUM_REGS + MIPS_SP_REGNUM, cache->base);
 
@@ -2067,223 +2041,6 @@
     return NULL;
 }
 
-/* Mark all the registers as unset in the saved_regs array
-   of THIS_CACHE.  Do nothing if THIS_CACHE is null.  */
-
-void
-reset_saved_regs (struct mips_frame_cache *this_cache)
-{
-  if (this_cache == NULL || this_cache->saved_regs == NULL)
-    return;
-
-  {
-    const int num_regs = NUM_REGS;
-    int i;
-
-    for (i = 0; i < num_regs; i++)
-      {
-        this_cache->saved_regs[i].addr = -1;
-      }
-  }
-}
-
-/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
-   the associated FRAME_CACHE if not null.  
-   Return the address of the first instruction past the prologue.  */
-
-static CORE_ADDR
-mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                      struct frame_info *next_frame,
-                      struct mips_frame_cache *this_cache)
-{
-  CORE_ADDR cur_pc;
-  CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
-  CORE_ADDR sp;
-  long frame_offset;
-  int  frame_reg = MIPS_SP_REGNUM;
-
-  CORE_ADDR end_prologue_addr = 0;
-  int seen_sp_adjust = 0;
-  int load_immediate_bytes = 0;
-
-  /* Can be called when there's no process, and hence when there's no
-     NEXT_FRAME.  */
-  if (next_frame != NULL)
-    sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
-  else
-    sp = 0;
-
-  if (limit_pc > start_pc + 200)
-    limit_pc = start_pc + 200;
-
-restart:
-
-  frame_offset = 0;
-  for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS_INSTLEN)
-    {
-      unsigned long inst, high_word, low_word;
-      int reg;
-
-      /* Fetch the instruction.   */
-      inst = (unsigned long) mips_fetch_instruction (cur_pc);
-
-      /* Save some code by pre-extracting some useful fields.  */
-      high_word = (inst >> 16) & 0xffff;
-      low_word = inst & 0xffff;
-      reg = high_word & 0x1f;
-
-      if (high_word == 0x27bd	/* addiu $sp,$sp,-i */
-	  || high_word == 0x23bd	/* addi $sp,$sp,-i */
-	  || high_word == 0x67bd)	/* daddiu $sp,$sp,-i */
-	{
-	  if (low_word & 0x8000)	/* negative stack adjustment? */
-            frame_offset += 0x10000 - low_word;
-	  else
-	    /* Exit loop if a positive stack adjustment is found, which
-	       usually means that the stack cleanup code in the function
-	       epilogue is reached.  */
-	    break;
-          seen_sp_adjust = 1;
-	}
-      else if ((high_word & 0xFFE0) == 0xafa0)	/* sw reg,offset($sp) */
-	{
-	  set_reg_offset (this_cache, reg, sp + low_word);
-	}
-      else if ((high_word & 0xFFE0) == 0xffa0)	/* sd reg,offset($sp) */
-	{
-	  /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra.  */
-	  set_reg_offset (this_cache, reg, sp + low_word);
-	}
-      else if (high_word == 0x27be)	/* addiu $30,$sp,size */
-	{
-	  /* Old gcc frame, r30 is virtual frame pointer.  */
-	  if ((long) low_word != frame_offset)
-	    frame_addr = sp + low_word;
-	  else if (frame_reg == MIPS_SP_REGNUM)
-	    {
-	      unsigned alloca_adjust;
-
-	      frame_reg = 30;
-	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
-	      alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
-	      if (alloca_adjust > 0)
-		{
-                  /* FP > SP + frame_size. This may be because of
-                     an alloca or somethings similar.  Fix sp to
-                     "pre-alloca" value, and try again.  */
-		  sp += alloca_adjust;
-                  /* Need to reset the status of all registers.  Otherwise,
-                     we will hit a guard that prevents the new address
-                     for each register to be recomputed during the second
-                     pass.  */
-                  reset_saved_regs (this_cache);
-		  goto restart;
-		}
-	    }
-	}
-      /* move $30,$sp.  With different versions of gas this will be either
-         `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
-         Accept any one of these.  */
-      else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
-	{
-	  /* New gcc frame, virtual frame pointer is at r30 + frame_size.  */
-	  if (frame_reg == MIPS_SP_REGNUM)
-	    {
-	      unsigned alloca_adjust;
-
-	      frame_reg = 30;
-	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
-	      alloca_adjust = (unsigned) (frame_addr - sp);
-	      if (alloca_adjust > 0)
-	        {
-                  /* FP > SP + frame_size. This may be because of
-                     an alloca or somethings similar.  Fix sp to
-                     "pre-alloca" value, and try again.  */
-	          sp = frame_addr;
-                  /* Need to reset the status of all registers.  Otherwise,
-                     we will hit a guard that prevents the new address
-                     for each register to be recomputed during the second
-                     pass.  */
-                  reset_saved_regs (this_cache);
-	          goto restart;
-	        }
-	    }
-	}
-      else if ((high_word & 0xFFE0) == 0xafc0)	/* sw reg,offset($30) */
-	{
-	  set_reg_offset (this_cache, reg, frame_addr + low_word);
-	}
-      else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
-               || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
-               || (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
-               || high_word == 0x3c1c /* lui $gp,n */
-               || high_word == 0x279c /* addiu $gp,$gp,n */
-               || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
-               || inst == 0x033ce021 /* addu $gp,$t9,$gp */
-              )
-       {
-         /* These instructions are part of the prologue, but we don't
-            need to do anything special to handle them.  */
-       }
-      /* The instructions below load $at or $t0 with an immediate
-         value in preparation for a stack adjustment via
-         subu $sp,$sp,[$at,$t0]. These instructions could also
-         initialize a local variable, so we accept them only before
-         a stack adjustment instruction was seen.  */
-      else if (!seen_sp_adjust
-               && (high_word == 0x3c01 /* lui $at,n */
-                   || high_word == 0x3c08 /* lui $t0,n */
-                   || high_word == 0x3421 /* ori $at,$at,n */
-                   || high_word == 0x3508 /* ori $t0,$t0,n */
-                   || high_word == 0x3401 /* ori $at,$zero,n */
-                   || high_word == 0x3408 /* ori $t0,$zero,n */
-                  ))
-       {
-          load_immediate_bytes += MIPS_INSTLEN;     /* FIXME!! */
-       }
-      else
-       {
-         /* This instruction is not an instruction typically found
-            in a prologue, so we must have reached the end of the
-            prologue.  */
-         /* FIXME: brobecker/2004-10-10: Can't we just break out of this
-            loop now?  Why would we need to continue scanning the function
-            instructions?  */
-         if (end_prologue_addr == 0)
-           end_prologue_addr = cur_pc;
-       }
-    }
-
-  if (this_cache != NULL)
-    {
-      this_cache->base = 
-        (frame_unwind_register_signed (next_frame, NUM_REGS + frame_reg)
-         + frame_offset);
-      /* FIXME: brobecker/2004-09-15: We should be able to get rid of
-         this assignment below, eventually.  But it's still needed
-         for now.  */
-      this_cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
-        = this_cache->saved_regs[NUM_REGS + RA_REGNUM];
-    }
-
-  /* If we didn't reach the end of the prologue when scanning the function
-     instructions, then set end_prologue_addr to the address of the
-     instruction immediately after the last one we scanned.  */
-  /* brobecker/2004-10-10: I don't think this would ever happen, but
-     we may as well be careful and do our best if we have a null
-     end_prologue_addr.  */
-  if (end_prologue_addr == 0)
-    end_prologue_addr = cur_pc;
-     
-  /* In a frameless function, we might have incorrectly
-     skipped some load immediate instructions. Undo the skipping
-     if the load immediate was not followed by a stack adjustment.  */
-  if (load_immediate_bytes && !seen_sp_adjust)
-    end_prologue_addr -= load_immediate_bytes;
-
-  return end_prologue_addr;
-}
-
 /* Heuristic unwinder for procedures using 32-bit instructions (covers
    both 32-bit and 64-bit MIPS ISAs).  Procedures using 16-bit
    instructions (a.k.a. MIPS16) are handled by the mips_insn16
@@ -2292,7 +2049,14 @@
 static struct mips_frame_cache *
 mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache)
 {
+  mips_extra_func_info_t proc_desc;
   struct mips_frame_cache *cache;
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  /* r0 bit means kernel trap */
+  int kernel_trap;
+  /* What registers have been saved?  Bitmasks.  */
+  unsigned long gen_mask, float_mask;
 
   if ((*this_cache) != NULL)
     return (*this_cache);
@@ -2301,7 +2065,7 @@
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
-  /* Analyze the function prologue.  */
+  /* Synthesize a proc descriptor.  */
   {
     const CORE_ADDR pc = frame_pc_unwind (next_frame);
     CORE_ADDR start_addr;
@@ -2309,14 +2073,16 @@
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
     if (start_addr == 0)
       start_addr = heuristic_proc_start (pc);
-    /* We can't analyze the prologue if we couldn't find the begining
-       of the function.  */
-    if (start_addr == 0)
-      return cache;
 
-    mips32_scan_prologue (start_addr, pc, next_frame, *this_cache);
+    proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache);
   }
   
+  if (proc_desc == NULL)
+    /* I'm not sure how/whether this can happen.  Normally when we
+       can't find a proc_desc, we "synthesize" one using
+       heuristic_proc_desc and set the saved_regs right away.  */
+    return cache;
+
   /* SP_REGNUM, contains the value and not the address.  */
   trad_frame_set_value (cache->saved_regs, NUM_REGS + MIPS_SP_REGNUM, cache->base);
 
@@ -2554,6 +2320,30 @@
 
 static struct mips_extra_func_info temp_proc_desc;
 
+/* Set a register's saved stack address in temp_saved_regs.  If an
+   address has already been set for this register, do nothing; this
+   way we will only recognize the first save of a given register in a
+   function prologue.
+
+   For simplicity, save the address in both [0 .. NUM_REGS) and
+   [NUM_REGS .. 2*NUM_REGS).  Strictly speaking, only the second range
+   is used as it is only second range (the ABI instead of ISA
+   registers) that comes into play when finding saved registers in a
+   frame.  */
+
+static void
+set_reg_offset (struct mips_frame_cache *this_cache, int regnum,
+		CORE_ADDR offset)
+{
+  if (this_cache != NULL
+      && this_cache->saved_regs[regnum].addr == -1)
+    {
+      this_cache->saved_regs[regnum + 0 * NUM_REGS].addr = offset;
+      this_cache->saved_regs[regnum + 1 * NUM_REGS].addr = offset;
+    }
+}
+
+
 /* Test whether the PC points to the return instruction at the
    end of a function. */
 
@@ -2667,24 +2457,355 @@
   return start_pc;
 }
 
+/* Fetch the immediate value from a MIPS16 instruction.
+   If the previous instruction was an EXTEND, use it to extend
+   the upper bits of the immediate value.  This is a helper function
+   for mips16_heuristic_proc_desc.  */
+
+static int
+mips16_get_imm (unsigned short prev_inst,	/* previous instruction */
+		unsigned short inst,	/* current instruction */
+		int nbits,	/* number of bits in imm field */
+		int scale,	/* scale factor to be applied to imm */
+		int is_signed)	/* is the imm field signed? */
+{
+  int offset;
+
+  if ((prev_inst & 0xf800) == 0xf000)	/* prev instruction was EXTEND? */
+    {
+      offset = ((prev_inst & 0x1f) << 11) | (prev_inst & 0x7e0);
+      if (offset & 0x8000)	/* check for negative extend */
+	offset = 0 - (0x10000 - (offset & 0xffff));
+      return offset | (inst & 0x1f);
+    }
+  else
+    {
+      int max_imm = 1 << nbits;
+      int mask = max_imm - 1;
+      int sign_bit = max_imm >> 1;
+
+      offset = inst & mask;
+      if (is_signed && (offset & sign_bit))
+	offset = 0 - (max_imm - offset);
+      return offset * scale;
+    }
+}
+
+
+/* Fill in values in temp_proc_desc based on the MIPS16 instruction
+   stream from start_pc to limit_pc.  */
+
+static void
+mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+			    CORE_ADDR sp,
+			    struct frame_info *next_frame,
+			    struct mips_frame_cache *this_cache)
+{
+  CORE_ADDR cur_pc;
+  CORE_ADDR frame_addr = 0;	/* Value of $r17, used as frame pointer */
+  unsigned short prev_inst = 0;	/* saved copy of previous instruction */
+  unsigned inst = 0;		/* current instruction */
+  unsigned entry_inst = 0;	/* the entry instruction */
+  int reg, offset;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+  PROC_FRAME_OFFSET (&temp_proc_desc) = 0;	/* size of stack frame */
+  PROC_FRAME_ADJUST (&temp_proc_desc) = 0;	/* offset of FP from SP */
+
+  for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS16_INSTLEN)
+    {
+      /* Save the previous instruction.  If it's an EXTEND, we'll extract
+         the immediate offset extension from it in mips16_get_imm.  */
+      prev_inst = inst;
+
+      /* Fetch and decode the instruction.   */
+      inst = (unsigned short) mips_fetch_instruction (cur_pc);
+      if ((inst & 0xff00) == 0x6300	/* addiu sp */
+	  || (inst & 0xff00) == 0xfb00)	/* daddiu sp */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
+	  if (offset < 0)	/* negative stack adjustment? */
+	    PROC_FRAME_OFFSET (&temp_proc_desc) -= offset;
+	  else
+	    /* Exit loop if a positive stack adjustment is found, which
+	       usually means that the stack cleanup code in the function
+	       epilogue is reached.  */
+	    break;
+	}
+      else if ((inst & 0xf800) == 0xd000)	/* sw reg,n($sp) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+	  reg = mips16_to_32_reg[(inst & 0x700) >> 8];
+	  PROC_REG_MASK (&temp_proc_desc) |= (1 << reg);
+	  set_reg_offset (this_cache, reg, sp + offset);
+	}
+      else if ((inst & 0xff00) == 0xf900)	/* sd reg,n($sp) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
+	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+	  PROC_REG_MASK (&temp_proc_desc) |= (1 << reg);
+	  set_reg_offset (this_cache, reg, sp + offset);
+	}
+      else if ((inst & 0xff00) == 0x6200)	/* sw $ra,n($sp) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+	  PROC_REG_MASK (&temp_proc_desc) |= (1 << RA_REGNUM);
+	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+	}
+      else if ((inst & 0xff00) == 0xfa00)	/* sd $ra,n($sp) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
+	  PROC_REG_MASK (&temp_proc_desc) |= (1 << RA_REGNUM);
+	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+	}
+      else if (inst == 0x673d)	/* move $s1, $sp */
+	{
+	  frame_addr = sp;
+	  PROC_FRAME_REG (&temp_proc_desc) = 17;
+	}
+      else if ((inst & 0xff00) == 0x0100)	/* addiu $s1,sp,n */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+	  frame_addr = sp + offset;
+	  PROC_FRAME_REG (&temp_proc_desc) = 17;
+	  PROC_FRAME_ADJUST (&temp_proc_desc) = offset;
+	}
+      else if ((inst & 0xFF00) == 0xd900)	/* sw reg,offset($s1) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
+	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+	  PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+	  set_reg_offset (this_cache, reg, frame_addr + offset);
+	}
+      else if ((inst & 0xFF00) == 0x7900)	/* sd reg,offset($s1) */
+	{
+	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
+	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
+	  PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+	  set_reg_offset (this_cache, reg, frame_addr + offset);
+	}
+      else if ((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700)	/* entry */
+	entry_inst = inst;	/* save for later processing */
+      else if ((inst & 0xf800) == 0x1800)	/* jal(x) */
+	cur_pc += MIPS16_INSTLEN;	/* 32-bit instruction */
+    }
+
+  /* The entry instruction is typically the first instruction in a function,
+     and it stores registers at offsets relative to the value of the old SP
+     (before the prologue).  But the value of the sp parameter to this
+     function is the new SP (after the prologue has been executed).  So we
+     can't calculate those offsets until we've seen the entire prologue,
+     and can calculate what the old SP must have been. */
+  if (entry_inst != 0)
+    {
+      int areg_count = (entry_inst >> 8) & 7;
+      int sreg_count = (entry_inst >> 6) & 3;
+
+      /* The entry instruction always subtracts 32 from the SP.  */
+      PROC_FRAME_OFFSET (&temp_proc_desc) += 32;
+
+      /* Now we can calculate what the SP must have been at the
+         start of the function prologue.  */
+      sp += PROC_FRAME_OFFSET (&temp_proc_desc);
+
+      /* Check if a0-a3 were saved in the caller's argument save area.  */
+      for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
+	{
+	  PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+	  set_reg_offset (this_cache, reg, sp + offset);
+	  offset += mips_abi_regsize (current_gdbarch);
+	}
+
+      /* Check if the ra register was pushed on the stack.  */
+      offset = -4;
+      if (entry_inst & 0x20)
+	{
+	  PROC_REG_MASK (&temp_proc_desc) |= 1 << RA_REGNUM;
+	  set_reg_offset (this_cache, RA_REGNUM, sp + offset);
+	  offset -= mips_abi_regsize (current_gdbarch);
+	}
+
+      /* Check if the s0 and s1 registers were pushed on the stack.  */
+      for (reg = 16; reg < sreg_count + 16; reg++)
+	{
+	  PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
+	  set_reg_offset (this_cache, reg, sp + offset);
+	  offset -= mips_abi_regsize (current_gdbarch);
+	}
+    }
+}
+
+/* Mark all the registers as unset in the saved_regs array
+   of THIS_CACHE.  Do nothing if THIS_CACHE is null.  */
+
+void
+reset_saved_regs (struct mips_frame_cache *this_cache)
+{
+  if (this_cache == NULL || this_cache->saved_regs == NULL)
+    return;
+
+  {
+    const int num_regs = NUM_REGS;
+    int i;
+
+    for (i = 0; i < num_regs; i++)
+      {
+        this_cache->saved_regs[i].addr = -1;
+      }
+  }
+}
+
+static void
+mips32_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+			    CORE_ADDR sp, struct frame_info *next_frame,
+			    struct mips_frame_cache *this_cache)
+{
+  CORE_ADDR cur_pc;
+  CORE_ADDR frame_addr = 0;	/* Value of $r30. Used by gcc for frame-pointer */
+  long frame_offset;
+  int  frame_reg = MIPS_SP_REGNUM;
+
+restart:
+
+  frame_offset = 0;
+  for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += MIPS_INSTLEN)
+    {
+      unsigned long inst, high_word, low_word;
+      int reg;
+
+      /* Fetch the instruction.   */
+      inst = (unsigned long) mips_fetch_instruction (cur_pc);
+
+      /* Save some code by pre-extracting some useful fields.  */
+      high_word = (inst >> 16) & 0xffff;
+      low_word = inst & 0xffff;
+      reg = high_word & 0x1f;
+
+      if (high_word == 0x27bd	/* addiu $sp,$sp,-i */
+	  || high_word == 0x23bd	/* addi $sp,$sp,-i */
+	  || high_word == 0x67bd)	/* daddiu $sp,$sp,-i */
+	{
+	  if (low_word & 0x8000)	/* negative stack adjustment? */
+            frame_offset += 0x10000 - low_word;
+	  else
+	    /* Exit loop if a positive stack adjustment is found, which
+	       usually means that the stack cleanup code in the function
+	       epilogue is reached.  */
+	    break;
+	}
+      else if ((high_word & 0xFFE0) == 0xafa0)	/* sw reg,offset($sp) */
+	{
+	  set_reg_offset (this_cache, reg, sp + low_word);
+	}
+      else if ((high_word & 0xFFE0) == 0xffa0)	/* sd reg,offset($sp) */
+	{
+	  /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and
+	     $ra.  */
+	  set_reg_offset (this_cache, reg, sp + low_word);
+	}
+      else if (high_word == 0x27be)	/* addiu $30,$sp,size */
+	{
+	  /* Old gcc frame, r30 is virtual frame pointer.  */
+	  if ((long) low_word != frame_offset)
+	    frame_addr = sp + low_word;
+	  else if (frame_reg == MIPS_SP_REGNUM)
+	    {
+	      unsigned alloca_adjust;
+
+	      frame_reg = 30;
+	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
+	      alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
+	      if (alloca_adjust > 0)
+		{
+                  /* FP > SP + frame_size. This may be because of
+                     an alloca or somethings similar.  Fix sp to
+                     "pre-alloca" value, and try again.  */
+		  sp += alloca_adjust;
+                  /* Need to reset the status of all registers.  Otherwise,
+                     we will hit a guard that prevents the new address
+                     for each register to be recomputed during the second
+                     pass.  */
+                  reset_saved_regs (this_cache);
+		  goto restart;
+		}
+	    }
+	}
+      /* move $30,$sp.  With different versions of gas this will be either
+         `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
+         Accept any one of these.  */
+      else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
+	{
+	  /* New gcc frame, virtual frame pointer is at r30 + frame_size.  */
+	  if (frame_reg == MIPS_SP_REGNUM)
+	    {
+	      unsigned alloca_adjust;
+
+	      frame_reg = 30;
+	      frame_addr = read_next_frame_reg (next_frame, NUM_REGS + 30);
+	      alloca_adjust = (unsigned) (frame_addr - sp);
+	      if (alloca_adjust > 0)
+	        {
+                  /* FP > SP + frame_size. This may be because of
+                     an alloca or somethings similar.  Fix sp to
+                     "pre-alloca" value, and try again.  */
+	          sp = frame_addr;
+                  /* Need to reset the status of all registers.  Otherwise,
+                     we will hit a guard that prevents the new address
+                     for each register to be recomputed during the second
+                     pass.  */
+                  reset_saved_regs (this_cache);
+	          goto restart;
+	        }
+	    }
+	}
+      else if ((high_word & 0xFFE0) == 0xafc0)	/* sw reg,offset($30) */
+	{
+	  set_reg_offset (this_cache, reg, frame_addr + low_word);
+	}
+    }
+
+  if (this_cache != NULL)
+    {
+      this_cache->base = 
+        (frame_unwind_register_signed (next_frame, NUM_REGS + frame_reg)
+         + frame_offset);
+      /* FIXME: brobecker/2004-09-15: We should be able to get rid of
+         this assignment below, eventually.  But it's still needed
+         for now.  */
+      this_cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
+        = this_cache->saved_regs[NUM_REGS + RA_REGNUM];
+    }
+}
+
 static mips_extra_func_info_t
 heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
 		     struct frame_info *next_frame,
 		     struct mips_frame_cache *this_cache)
 {
+  CORE_ADDR sp;
+
+  /* Can be called when there's no process, and hence when there's no
+     NEXT_FRAME.  */
+  if (next_frame != NULL)
+    sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
+  else
+    sp = 0;
+
   if (start_pc == 0)
     return NULL;
-
   memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
   PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
   PROC_FRAME_REG (&temp_proc_desc) = MIPS_SP_REGNUM;
   PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;
 
+  if (start_pc + 200 < limit_pc)
+    limit_pc = start_pc + 200;
   if (pc_is_mips16 (start_pc))
-    mips16_scan_prologue (start_pc, limit_pc, next_frame, this_cache);
+    mips16_heuristic_proc_desc (start_pc, limit_pc, sp,
+				next_frame, this_cache);
   else
-    mips32_scan_prologue (start_pc, limit_pc, next_frame, this_cache);
-
+    mips32_heuristic_proc_desc (start_pc, limit_pc, sp,
+				next_frame, this_cache);
   return &temp_proc_desc;
 }
 
@@ -4975,6 +5096,199 @@
 		     extract_unsigned_integer (buf, MIPS_INSTLEN));
 }
 
+/* Skip the PC past function prologue instructions (32-bit version).
+   This is a helper function for mips_skip_prologue.  */
+
+static CORE_ADDR
+mips32_skip_prologue (CORE_ADDR pc)
+{
+  t_inst inst;
+  CORE_ADDR end_pc;
+  int seen_sp_adjust = 0;
+  int load_immediate_bytes = 0;
+
+  /* Find an upper bound on the prologue.  */
+  end_pc = skip_prologue_using_sal (pc);
+  if (end_pc == 0)
+    end_pc = pc + 100;		/* Magic.  */
+
+  /* Skip the typical prologue instructions. These are the stack adjustment
+     instruction and the instructions that save registers on the stack
+     or in the gcc frame.  */
+  for (; pc < end_pc; pc += MIPS_INSTLEN)
+    {
+      unsigned long high_word;
+
+      inst = mips_fetch_instruction (pc);
+      high_word = (inst >> 16) & 0xffff;
+
+      if (high_word == 0x27bd	/* addiu $sp,$sp,offset */
+	  || high_word == 0x67bd)	/* daddiu $sp,$sp,offset */
+	seen_sp_adjust = 1;
+      else if (inst == 0x03a1e823 ||	/* subu $sp,$sp,$at */
+	       inst == 0x03a8e823)	/* subu $sp,$sp,$t0 */
+	seen_sp_adjust = 1;
+      else if (((inst & 0xFFE00000) == 0xAFA00000	/* sw reg,n($sp) */
+		|| (inst & 0xFFE00000) == 0xFFA00000)	/* sd reg,n($sp) */
+	       && (inst & 0x001F0000))	/* reg != $zero */
+	continue;
+
+      else if ((inst & 0xFFE00000) == 0xE7A00000)	/* swc1 freg,n($sp) */
+	continue;
+      else if ((inst & 0xF3E00000) == 0xA3C00000 && (inst & 0x001F0000))
+	/* sx reg,n($s8) */
+	continue;		/* reg != $zero */
+
+      /* move $s8,$sp.  With different versions of gas this will be either
+         `addu $s8,$sp,$zero' or `or $s8,$sp,$zero' or `daddu s8,sp,$0'.
+         Accept any one of these.  */
+      else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
+	continue;
+
+      else if ((inst & 0xFF9F07FF) == 0x00800021)	/* move reg,$a0-$a3 */
+	continue;
+      else if (high_word == 0x3c1c)	/* lui $gp,n */
+	continue;
+      else if (high_word == 0x279c)	/* addiu $gp,$gp,n */
+	continue;
+      else if (inst == 0x0399e021	/* addu $gp,$gp,$t9 */
+	       || inst == 0x033ce021)	/* addu $gp,$t9,$gp */
+	continue;
+      /* The following instructions load $at or $t0 with an immediate
+         value in preparation for a stack adjustment via
+         subu $sp,$sp,[$at,$t0]. These instructions could also initialize
+         a local variable, so we accept them only before a stack adjustment
+         instruction was seen.  */
+      else if (!seen_sp_adjust)
+	{
+	  if (high_word == 0x3c01 ||	/* lui $at,n */
+	      high_word == 0x3c08)	/* lui $t0,n */
+	    {
+	      load_immediate_bytes += MIPS_INSTLEN;	/* FIXME!! */
+	      continue;
+	    }
+	  else if (high_word == 0x3421 ||	/* ori $at,$at,n */
+		   high_word == 0x3508 ||	/* ori $t0,$t0,n */
+		   high_word == 0x3401 ||	/* ori $at,$zero,n */
+		   high_word == 0x3408)	/* ori $t0,$zero,n */
+	    {
+	      load_immediate_bytes += MIPS_INSTLEN;	/* FIXME!! */
+	      continue;
+	    }
+	  else
+	    break;
+	}
+      else
+	break;
+    }
+
+  /* In a frameless function, we might have incorrectly
+     skipped some load immediate instructions. Undo the skipping
+     if the load immediate was not followed by a stack adjustment.  */
+  if (load_immediate_bytes && !seen_sp_adjust)
+    pc -= load_immediate_bytes;
+  return pc;
+}
+
+/* Skip the PC past function prologue instructions (16-bit version).
+   This is a helper function for mips_skip_prologue.  */
+
+static CORE_ADDR
+mips16_skip_prologue (CORE_ADDR pc)
+{
+  CORE_ADDR end_pc;
+  int extend_bytes = 0;
+  int prev_extend_bytes;
+
+  /* Table of instructions likely to be found in a function prologue.  */
+  static struct
+  {
+    unsigned short inst;
+    unsigned short mask;
+  }
+  table[] =
+  {
+    {
+    0x6300, 0xff00}
+    ,				/* addiu $sp,offset */
+    {
+    0xfb00, 0xff00}
+    ,				/* daddiu $sp,offset */
+    {
+    0xd000, 0xf800}
+    ,				/* sw reg,n($sp) */
+    {
+    0xf900, 0xff00}
+    ,				/* sd reg,n($sp) */
+    {
+    0x6200, 0xff00}
+    ,				/* sw $ra,n($sp) */
+    {
+    0xfa00, 0xff00}
+    ,				/* sd $ra,n($sp) */
+    {
+    0x673d, 0xffff}
+    ,				/* move $s1,sp */
+    {
+    0xd980, 0xff80}
+    ,				/* sw $a0-$a3,n($s1) */
+    {
+    0x6704, 0xff1c}
+    ,				/* move reg,$a0-$a3 */
+    {
+    0xe809, 0xf81f}
+    ,				/* entry pseudo-op */
+    {
+    0x0100, 0xff00}
+    ,				/* addiu $s1,$sp,n */
+    {
+    0, 0}			/* end of table marker */
+  };
+
+  /* Find an upper bound on the prologue.  */
+  end_pc = skip_prologue_using_sal (pc);
+  if (end_pc == 0)
+    end_pc = pc + 100;		/* Magic.  */
+
+  /* Skip the typical prologue instructions. These are the stack adjustment
+     instruction and the instructions that save registers on the stack
+     or in the gcc frame.  */
+  for (; pc < end_pc; pc += MIPS16_INSTLEN)
+    {
+      unsigned short inst;
+      int i;
+
+      inst = mips_fetch_instruction (pc);
+
+      /* Normally we ignore an extend instruction.  However, if it is
+         not followed by a valid prologue instruction, we must adjust
+         the pc back over the extend so that it won't be considered
+         part of the prologue.  */
+      if ((inst & 0xf800) == 0xf000)	/* extend */
+	{
+	  extend_bytes = MIPS16_INSTLEN;
+	  continue;
+	}
+      prev_extend_bytes = extend_bytes;
+      extend_bytes = 0;
+
+      /* Check for other valid prologue instructions besides extend.  */
+      for (i = 0; table[i].mask != 0; i++)
+	if ((inst & table[i].mask) == table[i].inst)	/* found, get out */
+	  break;
+      if (table[i].mask != 0)	/* it was in table? */
+	continue;		/* ignore it */
+      else
+	/* non-prologue */
+	{
+	  /* Return the current pc, adjusted backwards by 2 if
+	     the previous instruction was an extend.  */
+	  return pc - prev_extend_bytes;
+	}
+    }
+  return pc;
+}
+
 /* To skip prologues, I use this predicate.  Returns either PC itself
    if the code at PC does not look like a function prologue; otherwise
    returns an address that (if we're lucky) follows the prologue.  If
@@ -4992,7 +5306,6 @@
      is greater.  */
 
   CORE_ADDR post_prologue_pc = after_prologue (pc);
-  CORE_ADDR limit_pc;
 
   if (post_prologue_pc != 0)
     return max (pc, post_prologue_pc);
@@ -5000,17 +5313,10 @@
   /* Can't determine prologue from the symbol table, need to examine
      instructions.  */
 
-  /* Find an upper limit on the function prologue using the debug
-     information.  If the debug information could not be used to provide
-     that bound, then use an arbitrary large number as the upper bound.  */
-  limit_pc = skip_prologue_using_sal (pc);
-  if (limit_pc == 0)
-    limit_pc = pc + 100;          /* Magic.  */
-
   if (pc_is_mips16 (pc))
-    return mips16_scan_prologue (pc, limit_pc, NULL, NULL);
+    return mips16_skip_prologue (pc);
   else
-    return mips32_scan_prologue (pc, limit_pc, NULL, NULL);
+    return mips32_skip_prologue (pc);
 }
 
 /* Root of all "set mips "/"show mips " commands. This will eventually be
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 5e50713..0fb44a1 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -2256,7 +2256,7 @@
   monitor_ops.to_fetch_registers = monitor_fetch_registers;
   monitor_ops.to_store_registers = monitor_store_registers;
   monitor_ops.to_prepare_to_store = monitor_prepare_to_store;
-  monitor_ops.deprecated_xfer_memory = monitor_xfer_memory;
+  monitor_ops.to_xfer_memory = monitor_xfer_memory;
   monitor_ops.to_files_info = monitor_files_info;
   monitor_ops.to_insert_breakpoint = monitor_insert_breakpoint;
   monitor_ops.to_remove_breakpoint = monitor_remove_breakpoint;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 227d4e3..9101566 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1272,7 +1272,7 @@
   procfs_ops.to_fetch_registers = procfs_fetch_registers;
   procfs_ops.to_store_registers = procfs_store_registers;
   procfs_ops.to_prepare_to_store = procfs_prepare_to_store;
-  procfs_ops.deprecated_xfer_memory = procfs_xfer_memory;
+  procfs_ops.to_xfer_memory = procfs_xfer_memory;
   procfs_ops.to_files_info = procfs_files_info;
   procfs_ops.to_insert_breakpoint = procfs_insert_breakpoint;
   procfs_ops.to_remove_breakpoint = procfs_remove_breakpoint;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3c4e0b4..69f61d4 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -184,7 +184,7 @@
     }
   if (abfd != NULL)
     {
-      objfile->name = xstrdup (bfd_get_filename (abfd));
+      objfile->name = mstrsave (objfile->md, bfd_get_filename (abfd));
       objfile->mtime = bfd_get_mtime (abfd);
 
       /* Build section table.  */
@@ -197,7 +197,7 @@
     }
   else
     {
-      objfile->name = xstrdup ("<<anonymous objfile>>");
+      objfile->name = mstrsave (objfile->md, "<<anonymous objfile>>");
     }
 
   /* Initialize the section indexes for this objfile, so that we can
diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c
index 16d2532..e7eefca 100644
--- a/gdb/ppc-bdm.c
+++ b/gdb/ppc-bdm.c
@@ -325,7 +325,7 @@
   bdm_ppc_ops.to_fetch_registers = bdm_ppc_fetch_registers;
   bdm_ppc_ops.to_store_registers = bdm_ppc_store_registers;
   bdm_ppc_ops.to_prepare_to_store = ocd_prepare_to_store;
-  bdm_ppc_ops.deprecated_xfer_memory = ocd_xfer_memory;
+  bdm_ppc_ops.to_xfer_memory = ocd_xfer_memory;
   bdm_ppc_ops.to_files_info = ocd_files_info;
   bdm_ppc_ops.to_insert_breakpoint = ocd_insert_breakpoint;
   bdm_ppc_ops.to_remove_breakpoint = ocd_remove_breakpoint;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 7e31a7f..0a1f152 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -172,7 +172,7 @@
   procfs_ops.to_fetch_registers     = procfs_fetch_registers;
   procfs_ops.to_store_registers     = procfs_store_registers;
   procfs_ops.to_xfer_partial        = procfs_xfer_partial;
-  procfs_ops.deprecated_xfer_memory = procfs_xfer_memory;
+  procfs_ops.to_xfer_memory         = procfs_xfer_memory;
   procfs_ops.to_insert_breakpoint   =  memory_insert_breakpoint;
   procfs_ops.to_remove_breakpoint   =  memory_remove_breakpoint;
   procfs_ops.to_notice_signals      = procfs_notice_signals;
@@ -4326,11 +4326,11 @@
     {
     case TARGET_OBJECT_MEMORY:
       if (readbuf)
-	return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-					       0/*write*/, NULL, ops);
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/,
+				       NULL, ops);
       if (writebuf)
-	return (*ops->deprecated_xfer_memory) (offset, writebuf, len,
-					       1/*write*/, NULL, ops);
+	return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/,
+				       NULL, ops);
       return -1;
 
 #ifdef NEW_PROC_API
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f34da79..12721c3 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -616,8 +616,8 @@
 	target_fetch_registers (regnum);
 #if 0
       /* FIXME: cagney/2004-08-07: At present a number of targets
-	 forget (or didn't know that they needed) to set this leading to
-	 panics.  Also is the problem that targets need to indicate
+	 forget (or didn't know that they needed) set this leading to
+	 panics.  Also is the problem that target's need to indicate
 	 that a register is in one of the possible states: valid,
 	 undefined, unknown.  The last of which isn't yet
 	 possible.  */
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 405a6b5..965ea97 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -2150,7 +2150,7 @@
   e7000_ops.to_fetch_registers = e7000_fetch_register;
   e7000_ops.to_store_registers = e7000_store_register;
   e7000_ops.to_prepare_to_store = e7000_prepare_to_store;
-  e7000_ops.deprecated_xfer_memory = e7000_xfer_inferior_memory;
+  e7000_ops.to_xfer_memory = e7000_xfer_inferior_memory;
   e7000_ops.to_files_info = e7000_files_info;
   e7000_ops.to_insert_breakpoint = e7000_insert_breakpoint;
   e7000_ops.to_remove_breakpoint = e7000_remove_breakpoint;
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index cca045e..a2fc046 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1450,23 +1450,16 @@
   return 0;
 }
 
-int
-m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+CORE_ADDR
+m32r_stopped_data_address (void)
 {
-  int rc = 0;
-  if (hit_watchpoint_addr != 0x00000000)
-    {
-      *addr_p = hit_watchpoint_addr;
-      rc = 1;
-    }
-  return rc;
+  return hit_watchpoint_addr;
 }
 
 int
 m32r_stopped_by_watchpoint (void)
 {
-  CORE_ADDR addr;
-  return m32r_stopped_data_address (&current_target, &addr);
+  return (hit_watchpoint_addr != 0x00000000);
 }
 
 
@@ -1575,7 +1568,7 @@
   m32r_ops.to_fetch_registers = m32r_fetch_register;
   m32r_ops.to_store_registers = m32r_store_register;
   m32r_ops.to_prepare_to_store = m32r_prepare_to_store;
-  m32r_ops.deprecated_xfer_memory = m32r_xfer_memory;
+  m32r_ops.to_xfer_memory = m32r_xfer_memory;
   m32r_ops.to_files_info = m32r_files_info;
   m32r_ops.to_insert_breakpoint = m32r_insert_breakpoint;
   m32r_ops.to_remove_breakpoint = m32r_remove_breakpoint;
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 175a4f9..b7dc35e 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -3306,7 +3306,7 @@
   mips_ops.to_fetch_registers = mips_fetch_registers;
   mips_ops.to_store_registers = mips_store_registers;
   mips_ops.to_prepare_to_store = mips_prepare_to_store;
-  mips_ops.deprecated_xfer_memory = mips_xfer_memory;
+  mips_ops.to_xfer_memory = mips_xfer_memory;
   mips_ops.to_files_info = mips_files_info;
   mips_ops.to_insert_breakpoint = mips_insert_breakpoint;
   mips_ops.to_remove_breakpoint = mips_remove_breakpoint;
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index 2571b78..1c14a03 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -895,7 +895,7 @@
   arm_rdi_ops.to_fetch_registers = arm_rdi_fetch_registers;
   arm_rdi_ops.to_store_registers = arm_rdi_store_registers;
   arm_rdi_ops.to_prepare_to_store = arm_rdi_prepare_to_store;
-  arm_rdi_ops.deprecated_xfer_memory = arm_rdi_xfer_memory;
+  arm_rdi_ops.to_xfer_memory = arm_rdi_xfer_memory;
   arm_rdi_ops.to_files_info = arm_rdi_files_info;
   arm_rdi_ops.to_insert_breakpoint = arm_rdi_insert_breakpoint;
   arm_rdi_ops.to_remove_breakpoint = arm_rdi_remove_breakpoint;
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index d480d53..2068311 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -1405,7 +1405,7 @@
   remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register;
   remote_rdp_ops.to_store_registers = remote_rdp_store_register;
   remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store;
-  remote_rdp_ops.deprecated_xfer_memory = remote_rdp_xfer_inferior_memory;
+  remote_rdp_ops.to_xfer_memory = remote_rdp_xfer_inferior_memory;
   remote_rdp_ops.to_files_info = remote_rdp_files_info;
   remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint;
   remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint;
diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c
index 0bf1c01..5b4b389 100644
--- a/gdb/remote-sds.c
+++ b/gdb/remote-sds.c
@@ -1061,7 +1061,7 @@
   sds_ops.to_fetch_registers = sds_fetch_registers;
   sds_ops.to_store_registers = sds_store_registers;
   sds_ops.to_prepare_to_store = sds_prepare_to_store;
-  sds_ops.deprecated_xfer_memory = sds_xfer_memory;
+  sds_ops.to_xfer_memory = sds_xfer_memory;
   sds_ops.to_files_info = sds_files_info;
   sds_ops.to_insert_breakpoint = sds_insert_breakpoint;
   sds_ops.to_remove_breakpoint = sds_remove_breakpoint;
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9e377ae..7a5c7b0 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -863,7 +863,7 @@
   gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
   gdbsim_ops.to_store_registers = gdbsim_store_register;
   gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
-  gdbsim_ops.deprecated_xfer_memory = gdbsim_xfer_inferior_memory;
+  gdbsim_ops.to_xfer_memory = gdbsim_xfer_inferior_memory;
   gdbsim_ops.to_files_info = gdbsim_files_info;
   gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
   gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
diff --git a/gdb/remote-st.c b/gdb/remote-st.c
index a71998c..eba847f 100644
--- a/gdb/remote-st.c
+++ b/gdb/remote-st.c
@@ -775,7 +775,7 @@
   st2000_ops.to_fetch_registers = st2000_fetch_register;
   st2000_ops.to_store_registers = st2000_store_register;
   st2000_ops.to_prepare_to_store = st2000_prepare_to_store;
-  st2000_ops.deprecated_xfer_memory = st2000_xfer_inferior_memory;
+  st2000_ops.to_xfer_memory = st2000_xfer_inferior_memory;
   st2000_ops.to_files_info = st2000_files_info;
   st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint;
   st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint;	/* Breakpoints */
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 76baff5..de5cc03 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -1343,7 +1343,7 @@
   vx_ops.to_open = vx_open;
   vx_ops.to_close = vx_close;
   vx_ops.to_attach = vx_attach;
-  vx_ops.deprecated_xfer_memory = vx_xfer_memory;
+  vx_ops.to_xfer_memory = vx_xfer_memory;
   vx_ops.to_files_info = vx_files_info;
   vx_ops.to_load = vx_load_command;
   vx_ops.to_lookup_symbol = vx_lookup_symbol;
@@ -1368,7 +1368,7 @@
   vx_run_ops.to_fetch_registers = vx_read_register;
   vx_run_ops.to_store_registers = vx_write_register;
   vx_run_ops.to_prepare_to_store = vx_prepare_to_store;
-  vx_run_ops.deprecated_xfer_memory = vx_xfer_memory;
+  vx_run_ops.to_xfer_memory = vx_xfer_memory;
   vx_run_ops.to_files_info = vx_run_files_info;
   vx_run_ops.to_insert_breakpoint = vx_insert_breakpoint;
   vx_run_ops.to_remove_breakpoint = vx_remove_breakpoint;
diff --git a/gdb/remote.c b/gdb/remote.c
index c389c4a..497f972 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -961,23 +961,6 @@
   show_packet_config_cmd (&remote_protocol_qPart_auxv);
 }
 
-static struct packet_config remote_protocol_p;
-
-static void
-set_remote_protocol_p_packet_cmd (char *args, int from_tty,
-				  struct cmd_list_element *c)
-{
-  update_packet_config (&remote_protocol_p);
-}
-
-static void
-show_remote_protocol_p_packet_cmd (char *args, int from_tty,
-				   struct cmd_list_element *c)
-{
-  show_packet_config_cmd (&remote_protocol_p);
-}
-
-
 
 /* Tokens for use by the asynchronous signal handlers for SIGINT */
 static void *sigint_remote_twice_token;
@@ -2058,7 +2041,6 @@
 {
   int i;
   update_packet_config (&remote_protocol_P);
-  update_packet_config (&remote_protocol_p);
   update_packet_config (&remote_protocol_qSymbol);
   update_packet_config (&remote_protocol_vcont);
   for (i = 0; i < NR_Z_PACKET_TYPES; i++)
@@ -3168,36 +3150,6 @@
 /* Read the remote registers into the block REGS.  */
 /* Currently we just read all the registers, so we don't use regnum.  */
 
-static int
-fetch_register_using_p (int regnum)
-{
-  struct remote_state *rs = get_remote_state ();
-  char *buf = alloca (rs->remote_packet_size), *p;
-  char regp[MAX_REGISTER_SIZE];
-  int i;
-
-  buf[0] = 'p';
-  bin2hex((char *) &regnum, &buf[1], sizeof(regnum));
-  buf[9] = 0;
-  remote_send (buf, rs->remote_packet_size);
-  if (buf[0] != 0 && buf[0] != 'E') {
-     p = buf;
-     i = 0;
-     while (p[0] != 0) {
-	if (p[1] == 0) {
-		error("fetch_register_using_p: early buf termination");
-		return 0;
-	}
-	regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
-        p += 2;
-    }
-    regcache_raw_supply (current_regcache, regnum, regp);
-    return 1;
- }
-
- return 0;
-}
-
 static void
 remote_fetch_registers (int regnum)
 {
@@ -3218,31 +3170,6 @@
 			"Attempt to fetch a non G-packet register when this "
 			"remote.c does not support the p-packet.");
     }
-      switch (remote_protocol_p.support)
-	{
-	case PACKET_DISABLE:
-	  break;
-	case PACKET_ENABLE:
-	  if (fetch_register_using_p (regnum))
-	    return;
-	  else
-	    error ("Protocol error: p packet not recognized by stub");
-	case PACKET_SUPPORT_UNKNOWN:
-	  if (fetch_register_using_p (regnum))
-	    {
-	      /* The stub recognized the 'p' packet.  Remember this.  */
-	      remote_protocol_p.support = PACKET_ENABLE;
-	      return;
-	    }
-	  else
-	    {
-	      /* The stub does not support the 'P' packet.  Use 'G'
-	         instead, and don't try using 'P' in the future (it
-	         will just waste our time).  */
-	      remote_protocol_p.support = PACKET_DISABLE;
-	      break;
-	    }
-	}
 
   sprintf (buf, "g");
   remote_send (buf, (rs->remote_packet_size));
@@ -4624,18 +4551,13 @@
 
 extern int stepped_after_stopped_by_watchpoint;
 
-static int
-remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+static CORE_ADDR
+remote_stopped_data_address (void)
 {
-  int rc = 0;
   if (remote_stopped_by_watchpoint ()
       || stepped_after_stopped_by_watchpoint)
-    {
-      *addr_p = remote_watch_data_address;
-      rc = 1;
-    }
-
-  return rc;
+    return remote_watch_data_address;
+  return (CORE_ADDR)0;
 }
 
 
@@ -4869,31 +4791,6 @@
   char *p2 = &buf2[0];
   char query_type;
 
-  /* Handle memory using remote_xfer_memory.  */
-  if (object == TARGET_OBJECT_MEMORY)
-    {
-      int xfered;
-      errno = 0;
-
-      if (writebuf != NULL)
-	{
-	  void *buffer = xmalloc (len);
-	  struct cleanup *cleanup = make_cleanup (xfree, buffer);
-	  memcpy (buffer, writebuf, len);
-	  xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops);
-	  do_cleanups (cleanup);
-	}
-      else
-	xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops);
-
-      if (xfered > 0)
-	return xfered;
-      else if (xfered == 0 && errno == 0)
-	return 0;
-      else
-	return -1;
-    }
-
   /* Only handle reads.  */
   if (writebuf != NULL || readbuf == NULL)
     return -1;
@@ -5247,7 +5144,7 @@
   remote_ops.to_fetch_registers = remote_fetch_registers;
   remote_ops.to_store_registers = remote_store_registers;
   remote_ops.to_prepare_to_store = remote_prepare_to_store;
-  remote_ops.deprecated_xfer_memory = remote_xfer_memory;
+  remote_ops.to_xfer_memory = remote_xfer_memory;
   remote_ops.to_files_info = remote_files_info;
   remote_ops.to_insert_breakpoint = remote_insert_breakpoint;
   remote_ops.to_remove_breakpoint = remote_remove_breakpoint;
@@ -5367,7 +5264,7 @@
   remote_async_ops.to_fetch_registers = remote_fetch_registers;
   remote_async_ops.to_store_registers = remote_store_registers;
   remote_async_ops.to_prepare_to_store = remote_prepare_to_store;
-  remote_async_ops.deprecated_xfer_memory = remote_xfer_memory;
+  remote_async_ops.to_xfer_memory = remote_xfer_memory;
   remote_async_ops.to_files_info = remote_files_info;
   remote_async_ops.to_insert_breakpoint = remote_insert_breakpoint;
   remote_async_ops.to_remove_breakpoint = remote_remove_breakpoint;
@@ -5435,7 +5332,6 @@
      remote_show_cmdlist for a list of sub commands to show.  */
   show_remote_protocol_Z_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_P_packet_cmd (args, from_tty, NULL);
-  show_remote_protocol_p_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
   show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
@@ -5632,13 +5528,6 @@
 			 &remote_set_cmdlist, &remote_show_cmdlist,
 			 1);
 
-  add_packet_config_cmd (&remote_protocol_p,
-			 "p", "fetch-register",
-			 set_remote_protocol_p_packet_cmd,
-			 show_remote_protocol_p_packet_cmd,
-			 &remote_set_cmdlist, &remote_show_cmdlist,
-			 1);
-
   add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP],
 			 "Z0", "software-breakpoint",
 			 set_remote_protocol_Z_software_bp_packet_cmd,
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index df36076..59067c6 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -442,10 +442,10 @@
    to debugger memory starting at MYADDR.  Copy to inferior if
    WRITE is nonzero.
 
-   Returns the length copied, which is either the LEN argument or
-   zero.  This xfer function does not do partial moves, since
-   deprecated_child_ops doesn't allow memory operations to cross below
-   us in the target stack anyway.  */
+   Returns the length copied, which is either the LEN argument or zero.
+   This xfer function does not do partial moves, since child_ops
+   doesn't allow memory operations to cross below us in the target stack
+   anyway.  */
 
 int
 child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 37988a3..36741c5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1478,11 +1478,14 @@
 	     There are 13 fpr's reserved for passing parameters. At this point
 	     there is no way we would run out of them.  */
 
-	  gdb_assert (len <= 8);
+	  if (len > 8)
+	    printf_unfiltered ("Fatal Error: a floating point parameter "
+                               "#%d with a size > 8 is found!\n", argno);
 
-	  regcache_cooked_write (regcache,
-	                         tdep->ppc_fp0_regnum + 1 + f_argno,
-	                         VALUE_CONTENTS (arg));
+	  memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE
+                                        (tdep->ppc_fp0_regnum + 1 + f_argno)],
+		  VALUE_CONTENTS (arg),
+		  len);
 	  ++f_argno;
 	}
 
@@ -1492,15 +1495,12 @@
 	  /* Argument takes more than one register.  */
 	  while (argbytes < len)
 	    {
-	      char word[MAX_REGISTER_SIZE];
-	      memset (word, 0, reg_size);
-	      memcpy (word,
+	      memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0,
+		      reg_size);
+	      memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)],
 		      ((char *) VALUE_CONTENTS (arg)) + argbytes,
 		      (len - argbytes) > reg_size
 		        ? reg_size : len - argbytes);
-	      regcache_cooked_write (regcache,
-	                            tdep->ppc_gp0_regnum + 3 + ii,
-				    word);
 	      ++ii, argbytes += reg_size;
 
 	      if (ii >= 8)
@@ -1513,11 +1513,9 @@
 	{
 	  /* Argument can fit in one register.  No problem.  */
 	  int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;
-	  char word[MAX_REGISTER_SIZE];
-
-	  memset (word, 0, reg_size);
-	  memcpy (word, VALUE_CONTENTS (arg), len);
-	  regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
+	  memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0, reg_size);
+	  memcpy ((char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)] + adj, 
+	          VALUE_CONTENTS (arg), len);
 	}
       ++argno;
     }
@@ -1594,11 +1592,15 @@
 	  if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
 	    {
 
-	      gdb_assert (len <= 8);
+	      if (len > 8)
+		printf_unfiltered ("Fatal Error: a floating point parameter"
+                                   " #%d with a size > 8 is found!\n", argno);
 
-	      regcache_cooked_write (regcache,
-				     tdep->ppc_fp0_regnum + 1 + f_argno,
-				     VALUE_CONTENTS (arg));
+	      memcpy (&(deprecated_registers
+                        [DEPRECATED_REGISTER_BYTE
+                         (tdep->ppc_fp0_regnum + 1 + f_argno)]),
+		      VALUE_CONTENTS (arg),
+		      len);
 	      ++f_argno;
 	    }
 
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 48e994d..03ef25c 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -56,7 +56,7 @@
 
 static void (*sh_show_regs) (void);
 
-#define SH_NUM_REGS 67
+#define SH_NUM_REGS 59
 
 struct sh_frame_cache
 {
@@ -86,7 +86,6 @@
     "", "",
     "", "", "", "", "", "", "", "",
     "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -108,7 +107,6 @@
     "ssr", "spc",
     "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
     "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1"
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -130,7 +128,6 @@
     "ssr", "spc",
     "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
     "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -152,87 +149,6 @@
     "", "",
     "", "", "", "", "", "", "", "",
     "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
-  };
-  if (reg_nr < 0)
-    return NULL;
-  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
-    return NULL;
-  return register_names[reg_nr];
-}
-
-static const char *
-sh_sh2a_register_name (int reg_nr)
-{
-  static char *register_names[] = {
-    /* general registers 0-15 */
-    "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-    "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
-    /* 16 - 22 */
-    "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
-    /* 23, 24 */
-    "fpul", "fpscr",
-    /* floating point registers 25 - 40 */
-    "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
-    "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
-    /* 41, 42 */
-    "", "",
-    /* 43 - 62.  Banked registers.  The bank number used is determined by
-       the bank register (63). */
-    "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
-    "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
-    "machb", "ivnb", "prb", "gbrb", "maclb",
-    /* 63: register bank number, not a real register but used to
-       communicate the register bank currently get/set.  This register
-       is hidden to the user, who manipulates it using the pseudo
-       register called "bank" (67).  See below.  */
-    "",
-    /* 64 - 66 */
-    "ibcr", "ibnr", "tbr",
-    /* 67: register bank number, the user visible pseudo register.  */
-    "bank",
-    /* double precision (pseudo) 68 - 75 */
-    "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14",
-  };
-  if (reg_nr < 0)
-    return NULL;
-  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
-    return NULL;
-  return register_names[reg_nr];
-}
-
-static const char *
-sh_sh2a_nofpu_register_name (int reg_nr)
-{
-  static char *register_names[] = {
-    /* general registers 0-15 */
-    "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-    "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
-    /* 16 - 22 */
-    "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
-    /* 23, 24 */
-    "", "",
-    /* floating point registers 25 - 40 */
-    "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
-    /* 41, 42 */
-    "", "",
-    /* 43 - 62.  Banked registers.  The bank number used is determined by
-       the bank register (63). */
-    "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
-    "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
-    "machb", "ivnb", "prb", "gbrb", "maclb",
-    /* 63: register bank number, not a real register but used to
-       communicate the register bank currently get/set.  This register
-       is hidden to the user, who manipulates it using the pseudo
-       register called "bank" (67).  See below.  */
-    "",
-    /* 64 - 66 */
-    "ibcr", "ibnr", "tbr",
-    /* 67: register bank number, the user visible pseudo register.  */
-    "bank",
-    /* double precision (pseudo) 68 - 75 */
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -254,7 +170,6 @@
     "", "",
     "rs", "re", "", "", "", "", "", "",
     "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -277,7 +192,6 @@
     "rs", "re", "", "", "", "", "", "",
     "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
     "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -306,9 +220,6 @@
     "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
     /* bank 1 51 - 58 */
     "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
-    "", "", "", "", "", "", "", "",
-    /* pseudo bank register. */
-    "",
     /* double precision (pseudo) 59 - 66 */
     "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14",
     /* vectors (pseudo) 67 - 70 */
@@ -343,9 +254,6 @@
     "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
     /* bank 1 51 - 58 */
     "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
-    "", "", "", "", "", "", "", "",
-    /* pseudo bank register. */
-    "",
     /* double precision (pseudo) 59 - 66 -- not for nofpu target */
     "", "", "", "", "", "", "", "",
     /* vectors (pseudo) 67 - 70 -- not for nofpu target */
@@ -372,7 +280,6 @@
     "rs", "re", "", "", "", "", "", "",
     "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
     "", "", "", "", "", "", "", "",
-    "", "", "", "", "", "", "", "",
   };
   if (reg_nr < 0)
     return NULL;
@@ -411,10 +318,6 @@
    r15-4-->r15, PR-->(r15) */
 #define IS_STS(x)  		((x) == 0x4f22)
 
-/* STS.L MACL,@-r15  0100111100010010
-   r15-4-->r15, MACL-->(r15) */
-#define IS_MACL_STS(x)  	((x) == 0x4f12)
-
 /* MOV.L Rm,@-r15  00101111mmmm0110
    r15-4-->r15, Rm-->(R15) */
 #define IS_PUSH(x) 		(((x) & 0xff0f) == 0x2f06)
@@ -462,8 +365,6 @@
 #define IS_MOVW_PCREL_TO_REG(x)	(((x) & 0xf000) == 0x9000)
 /* MOV.L @(disp*4,PC),Rn      1101nnnndddddddd */
 #define IS_MOVL_PCREL_TO_REG(x)	(((x) & 0xf000) == 0xd000)
-/* MOVI20 #imm20,Rn           0000nnnniiii0000 */
-#define IS_MOVI20(x)		(((x) & 0xf00f) == 0x0000)
 /* SUB Rn,R15                 00111111nnnn1000 */
 #define IS_SUB_REG_FROM_SP(x)	(((x) & 0xff0f) == 0x3f08)
 
@@ -473,7 +374,6 @@
 #define IS_RESTORE_FP(x)	((x) == 0x6ef6)
 #define IS_RTS(x)		((x) == 0x000b)
 #define IS_LDS(x)  		((x) == 0x4f26)
-#define IS_MACL_LDS(x)  	((x) == 0x4f16)
 #define IS_MOV_FP_SP(x)  	((x) == 0x6fe3)
 #define IS_ADD_REG_TO_FP(x)	(((x) & 0xff0f) == 0x3e0c)
 #define IS_ADD_IMM_FP(x) 	(((x) & 0xff00) == 0x7e00)
@@ -515,11 +415,6 @@
 	  cache->saved_regs[PR_REGNUM] = cache->sp_offset;
 	  cache->sp_offset += 4;
 	}
-      else if (IS_MACL_STS (inst))
-	{
-	  cache->saved_regs[MACL_REGNUM] = cache->sp_offset;
-	  cache->sp_offset += 4;
-	}
       else if (IS_MOV_R3 (inst))
 	{
 	  r3_val = ((inst & 0xff) ^ 0x80) - 0x80;
@@ -565,25 +460,6 @@
 		}
 	    }
 	}
-      else if (IS_MOVI20 (inst))
-        {
-	  if (sav_reg < 0)
-	    {
-	      reg = GET_TARGET_REG (inst);
-	      if (reg < 14)
-	        {
-		  sav_reg = reg;
-		  sav_offset = GET_SOURCE_REG (inst) << 16;
-		  /* MOVI20 is a 32 bit instruction! */
-		  pc += 2;
-		  sav_offset |= read_memory_unsigned_integer (pc, 2);
-		  /* Now sav_offset contains an unsigned 20 bit value.
-		     It must still get sign extended.  */
-		  if (sav_offset & 0x00080000)
-		    sav_offset |= 0xfff00000;
-		}
-	    }
-	}
       else if (IS_SUB_REG_FROM_SP (inst))
 	{
 	  reg = GET_SOURCE_REG (inst);
@@ -1281,34 +1157,6 @@
     sh_default_store_return_value (type, regcache, valbuf);
 }
 
-static enum return_value_convention
-sh_return_value_nofpu (struct gdbarch *gdbarch, struct type *type,
-		       struct regcache *regcache,
-		       void *readbuf, const void *writebuf)
-{
-  if (sh_use_struct_convention (0, type))
-    return RETURN_VALUE_STRUCT_CONVENTION;
-  if (writebuf)
-    sh_default_store_return_value (type, regcache, writebuf);
-  else if (readbuf)
-    sh_default_extract_return_value (type, regcache, readbuf);
-  return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
-static enum return_value_convention
-sh_return_value_fpu (struct gdbarch *gdbarch, struct type *type,
-		     struct regcache *regcache,
-		     void *readbuf, const void *writebuf)
-{
-  if (sh_use_struct_convention (0, type))
-    return RETURN_VALUE_STRUCT_CONVENTION;
-  if (writebuf)
-    sh3e_sh4_store_return_value (type, regcache, writebuf);
-  else if (readbuf)
-    sh3e_sh4_extract_return_value (type, regcache, readbuf);
-  return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
 /* Print the registers in a form similar to the E7000 */
 
 static void
@@ -1403,141 +1251,6 @@
 }
 
 static void
-sh2a_show_regs (void)
-{
-  int pr = read_register (FPSCR_REGNUM) & 0x80000;
-  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
-		   paddr (read_register (PC_REGNUM)),
-		   (long) read_register (SR_REGNUM),
-		   (long) read_register (PR_REGNUM),
-		   (long) read_register (MACH_REGNUM),
-		   (long) read_register (MACL_REGNUM));
-
-  printf_filtered ("GBR=%08lx VBR=%08lx TBR=%08lx",
-		   (long) read_register (GBR_REGNUM),
-		   (long) read_register (VBR_REGNUM),
-		   (long) read_register (TBR_REGNUM));
-  printf_filtered (" FPUL=%08lx FPSCR=%08lx\n",
-		   (long) read_register (FPUL_REGNUM),
-		   (long) read_register (FPSCR_REGNUM));
-
-  printf_filtered ("R0-R7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (0), (long) read_register (1),
-		   (long) read_register (2), (long) read_register (3),
-		   (long) read_register (4), (long) read_register (5),
-		   (long) read_register (6), (long) read_register (7));
-  printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (8), (long) read_register (9),
-		   (long) read_register (10), (long) read_register (11),
-		   (long) read_register (12), (long) read_register (13),
-		   (long) read_register (14), (long) read_register (15));
-
-  printf_filtered ((pr
-		    ? "DR0-DR6  %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
-		    :
-		    "FP0-FP7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
-		   (long) read_register (FP0_REGNUM + 0),
-		   (long) read_register (FP0_REGNUM + 1),
-		   (long) read_register (FP0_REGNUM + 2),
-		   (long) read_register (FP0_REGNUM + 3),
-		   (long) read_register (FP0_REGNUM + 4),
-		   (long) read_register (FP0_REGNUM + 5),
-		   (long) read_register (FP0_REGNUM + 6),
-		   (long) read_register (FP0_REGNUM + 7));
-  printf_filtered ((pr ?
-		    "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n" :
-		    "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
-		   (long) read_register (FP0_REGNUM + 8),
-		   (long) read_register (FP0_REGNUM + 9),
-		   (long) read_register (FP0_REGNUM + 10),
-		   (long) read_register (FP0_REGNUM + 11),
-		   (long) read_register (FP0_REGNUM + 12),
-		   (long) read_register (FP0_REGNUM + 13),
-		   (long) read_register (FP0_REGNUM + 14),
-		   (long) read_register (FP0_REGNUM + 15));
-  printf_filtered ("BANK=%-3d\n", (int) read_register (BANK_REGNUM));
-  printf_filtered ("R0b - R7b  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 0),
-		   (long) read_register (R0_BANK0_REGNUM + 1),
-		   (long) read_register (R0_BANK0_REGNUM + 2),
-		   (long) read_register (R0_BANK0_REGNUM + 3),
-		   (long) read_register (R0_BANK0_REGNUM + 4),
-		   (long) read_register (R0_BANK0_REGNUM + 5),
-		   (long) read_register (R0_BANK0_REGNUM + 6),
-		   (long) read_register (R0_BANK0_REGNUM + 7));
-  printf_filtered ("R8b - R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 8),
-		   (long) read_register (R0_BANK0_REGNUM + 9),
-		   (long) read_register (R0_BANK0_REGNUM + 10),
-		   (long) read_register (R0_BANK0_REGNUM + 11),
-		   (long) read_register (R0_BANK0_REGNUM + 12),
-		   (long) read_register (R0_BANK0_REGNUM + 13),
-		   (long) read_register (R0_BANK0_REGNUM + 14));
-  printf_filtered ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 15),
-		   (long) read_register (R0_BANK0_REGNUM + 16),
-		   (long) read_register (R0_BANK0_REGNUM + 17),
-		   (long) read_register (R0_BANK0_REGNUM + 18),
-		   (long) read_register (R0_BANK0_REGNUM + 19));
-}
-
-static void
-sh2a_nofpu_show_regs (void)
-{
-  int pr = read_register (FPSCR_REGNUM) & 0x80000;
-  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
-		   paddr (read_register (PC_REGNUM)),
-		   (long) read_register (SR_REGNUM),
-		   (long) read_register (PR_REGNUM),
-		   (long) read_register (MACH_REGNUM),
-		   (long) read_register (MACL_REGNUM));
-
-  printf_filtered ("GBR=%08lx VBR=%08lx TBR=%08lx",
-		   (long) read_register (GBR_REGNUM),
-		   (long) read_register (VBR_REGNUM),
-		   (long) read_register (TBR_REGNUM));
-  printf_filtered (" FPUL=%08lx FPSCR=%08lx\n",
-		   (long) read_register (FPUL_REGNUM),
-		   (long) read_register (FPSCR_REGNUM));
-
-  printf_filtered ("R0-R7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (0), (long) read_register (1),
-		   (long) read_register (2), (long) read_register (3),
-		   (long) read_register (4), (long) read_register (5),
-		   (long) read_register (6), (long) read_register (7));
-  printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (8), (long) read_register (9),
-		   (long) read_register (10), (long) read_register (11),
-		   (long) read_register (12), (long) read_register (13),
-		   (long) read_register (14), (long) read_register (15));
-
-  printf_filtered ("BANK=%-3d\n", (int) read_register (BANK_REGNUM));
-  printf_filtered ("R0b - R7b  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 0),
-		   (long) read_register (R0_BANK0_REGNUM + 1),
-		   (long) read_register (R0_BANK0_REGNUM + 2),
-		   (long) read_register (R0_BANK0_REGNUM + 3),
-		   (long) read_register (R0_BANK0_REGNUM + 4),
-		   (long) read_register (R0_BANK0_REGNUM + 5),
-		   (long) read_register (R0_BANK0_REGNUM + 6),
-		   (long) read_register (R0_BANK0_REGNUM + 7));
-  printf_filtered ("R8b - R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 8),
-		   (long) read_register (R0_BANK0_REGNUM + 9),
-		   (long) read_register (R0_BANK0_REGNUM + 10),
-		   (long) read_register (R0_BANK0_REGNUM + 11),
-		   (long) read_register (R0_BANK0_REGNUM + 12),
-		   (long) read_register (R0_BANK0_REGNUM + 13),
-		   (long) read_register (R0_BANK0_REGNUM + 14));
-  printf_filtered ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
-		   (long) read_register (R0_BANK0_REGNUM + 15),
-		   (long) read_register (R0_BANK0_REGNUM + 16),
-		   (long) read_register (R0_BANK0_REGNUM + 17),
-		   (long) read_register (R0_BANK0_REGNUM + 18),
-		   (long) read_register (R0_BANK0_REGNUM + 19));
-}
-
-static void
 sh3e_show_regs (void)
 {
   printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
@@ -1758,18 +1471,6 @@
     (*sh_show_regs) ();
 }
 
-static struct type *
-sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr)
-{
-  if ((reg_nr >= FP0_REGNUM
-       && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
-    return builtin_type_float;
-  else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
-    return builtin_type_double;
-  else
-    return builtin_type_int;
-}
-
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
 static struct type *
@@ -1894,9 +1595,6 @@
   int base_regnum, portion;
   char temp_buffer[MAX_REGISTER_SIZE];
 
-  if (reg_nr == PSEUDO_BANK_REGNUM)
-    regcache_raw_read (regcache, BANK_REGNUM, buffer);
-  else
   if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
     {
       base_regnum = dr_reg_base_num (reg_nr);
@@ -1933,19 +1631,7 @@
   int base_regnum, portion;
   char temp_buffer[MAX_REGISTER_SIZE];
 
-  if (reg_nr == PSEUDO_BANK_REGNUM)
-    {
-      /* When the bank register is written to, the whole register bank
-         is switched and all values in the bank registers must be read
-	 from the target/sim again. We're just invalidating the regcache
-	 so that a re-read happens next time it's necessary.  */
-      int bregnum;
-
-      regcache_raw_write (regcache, BANK_REGNUM, buffer);
-      for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum)
-        set_register_cached (bregnum, 0);
-    }
-  else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
+  if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
     {
       base_regnum = dr_reg_base_num (reg_nr);
 
@@ -1999,12 +1685,6 @@
 		    (int) read_register (first_fp_reg_num),
 		    (int) read_register (first_fp_reg_num + 1));
 }
-static void
-do_bank_register_info (struct gdbarch *gdbarch, struct ui_file *file)
-{
-  fprintf_filtered (file, "bank           %d\n",
-		    (int) read_register (BANK_REGNUM));
-}
 
 static void
 sh_print_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file,
@@ -2013,8 +1693,6 @@
   if (regnum < NUM_REGS || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
     internal_error (__FILE__, __LINE__,
 		    "Invalid pseudo register number %d\n", regnum);
-  else if (regnum == PSEUDO_BANK_REGNUM)
-    do_bank_register_info (gdbarch, file);
   else if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
     do_dr_register_info (gdbarch, file, regnum);
   else if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM)
@@ -2137,11 +1815,6 @@
 	    sh_do_register (gdbarch, file, regnum);	/* All other regs */
 	}
 
-      if (regnum == PSEUDO_BANK_REGNUM
-      	  && REGISTER_NAME (regnum)
-	  && *REGISTER_NAME (regnum))
-	sh_print_pseudo_register (gdbarch, file, regnum++);
-
       if (fpregs)
 	while (regnum < NUM_REGS + NUM_PSEUDO_REGS)
 	  {
@@ -2210,35 +1883,6 @@
   return nr;
 }
 
-static int
-sh_sh2a_register_sim_regno (int nr)
-{
-  switch (nr)
-    {
-      case TBR_REGNUM:
-        return SIM_SH_TBR_REGNUM;
-      case IBNR_REGNUM:
-        return SIM_SH_IBNR_REGNUM;
-      case IBCR_REGNUM:
-        return SIM_SH_IBCR_REGNUM;
-      case BANK_REGNUM:
-        return SIM_SH_BANK_REGNUM;
-      case MACLB_REGNUM:
-        return SIM_SH_BANK_MACL_REGNUM;
-      case GBRB_REGNUM:
-        return SIM_SH_BANK_GBR_REGNUM;
-      case PRB_REGNUM:
-        return SIM_SH_BANK_PR_REGNUM;
-      case IVNB_REGNUM:
-        return SIM_SH_BANK_IVN_REGNUM;
-      case MACHB_REGNUM:
-        return SIM_SH_BANK_MACH_REGNUM;
-      default:
-        break;
-    }
-  return legacy_register_sim_regno (nr);
-}
-
 static struct sh_frame_cache *
 sh_alloc_frame_cache (void)
 {
@@ -2463,16 +2107,8 @@
       else if (!IS_RESTORE_FP (read_memory_unsigned_integer (addr + 2, 2)))
 	return 0;
 
-      inst = read_memory_unsigned_integer (addr - 2, 2);
-
-      /* Step over possible lds.l @r15+,macl. */
-      if (IS_MACL_LDS (inst))
-	{
-	  addr -= 2;
-	  inst = read_memory_unsigned_integer (addr - 2, 2);
-	}
-
       /* Step over possible lds.l @r15+,pr. */
+      inst = read_memory_unsigned_integer (addr - 2, 2);
       if (IS_LDS (inst))
 	{
 	  addr -= 2;
@@ -2495,14 +2131,6 @@
 	  inst = read_memory_unsigned_integer (addr - 2, 2);
 	}
 
-      /* On SH2a check if the previous instruction was perhaps a MOVI20.
-         That's allowed for the epilogue.  */
-      if ((gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a
-           || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a_nofpu)
-          && addr > func_addr + 6
-	  && IS_MOVI20 (read_memory_unsigned_integer (addr - 4, 2)))
-	addr -= 4;
-
       if (pc >= addr)
 	return 1;
     }
@@ -2522,12 +2150,6 @@
     case bfd_mach_sh2e:
       sh_show_regs = sh2e_show_regs;
       break;
-    case bfd_mach_sh2a:
-      sh_show_regs = sh2a_show_regs;
-      break;
-    case bfd_mach_sh2a_nofpu:
-      sh_show_regs = sh2a_nofpu_show_regs;
-      break;
     case bfd_mach_sh_dsp:
       sh_show_regs = sh_dsp_show_regs;
       break;
@@ -2592,15 +2214,16 @@
   set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info);
 
   set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
+  set_gdbarch_deprecated_use_struct_convention (gdbarch, sh_use_struct_convention);
 
   set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
   set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
 
   set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
 
-  set_gdbarch_return_value (gdbarch, sh_return_value_nofpu);
-  set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
-					    sh_extract_struct_value_address);
+  set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value);
+  set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
 
   set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -2634,32 +2257,12 @@
       set_gdbarch_register_name (gdbarch, sh_sh2e_register_name);
       set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
       set_gdbarch_fp0_regnum (gdbarch, 25);
-      set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+      set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+      set_gdbarch_extract_return_value (gdbarch,
+					sh3e_sh4_extract_return_value);
       set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
       break;
 
-    case bfd_mach_sh2a:
-      set_gdbarch_register_name (gdbarch, sh_sh2a_register_name);
-      set_gdbarch_register_type (gdbarch, sh_sh2a_register_type);
-      set_gdbarch_register_sim_regno (gdbarch, sh_sh2a_register_sim_regno);
-
-      set_gdbarch_fp0_regnum (gdbarch, 25);
-      set_gdbarch_num_pseudo_regs (gdbarch, 9);
-      set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
-      set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
-      set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
-      set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
-      break;
-
-    case bfd_mach_sh2a_nofpu:
-      set_gdbarch_register_name (gdbarch, sh_sh2a_nofpu_register_name);
-      set_gdbarch_register_sim_regno (gdbarch, sh_sh2a_register_sim_regno);
-
-      set_gdbarch_num_pseudo_regs (gdbarch, 1);
-      set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
-      set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
-      break;
-
     case bfd_mach_sh_dsp:
       set_gdbarch_register_name (gdbarch, sh_sh_dsp_register_name);
       set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno);
@@ -2676,7 +2279,9 @@
       set_gdbarch_register_name (gdbarch, sh_sh3e_register_name);
       set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
       set_gdbarch_fp0_regnum (gdbarch, 25);
-      set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+      set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+      set_gdbarch_extract_return_value (gdbarch,
+					sh3e_sh4_extract_return_value);
       set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
       break;
 
@@ -2690,10 +2295,12 @@
       set_gdbarch_register_name (gdbarch, sh_sh4_register_name);
       set_gdbarch_register_type (gdbarch, sh_sh4_register_type);
       set_gdbarch_fp0_regnum (gdbarch, 25);
-      set_gdbarch_num_pseudo_regs (gdbarch, 13);
+      set_gdbarch_num_pseudo_regs (gdbarch, 12);
       set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
       set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
-      set_gdbarch_return_value (gdbarch, sh_return_value_fpu);
+      set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value);
+      set_gdbarch_extract_return_value (gdbarch,
+					sh3e_sh4_extract_return_value);
       set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu);
       break;
 
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index 9321b59..a2ef760 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -64,23 +64,11 @@
     RE_REGNUM = 44,
     DSP_R0_BANK_REGNUM = 51,
     DSP_R7_BANK_REGNUM = 58,
-    /* sh2a register */
-    R0_BANK0_REGNUM = 43,
-    MACHB_REGNUM = 58,
-    IVNB_REGNUM = 59,
-    PRB_REGNUM = 60,
-    GBRB_REGNUM = 61,
-    MACLB_REGNUM = 62,
-    BANK_REGNUM = 63,
-    IBCR_REGNUM = 64,
-    IBNR_REGNUM = 65,
-    TBR_REGNUM = 66,
-    PSEUDO_BANK_REGNUM = 67,
     /* Floating point pseudo registers */
-    DR0_REGNUM = 68,
-    DR_LAST_REGNUM = 75,
-    FV0_REGNUM = 76,
-    FV_LAST_REGNUM = 79
+    DR0_REGNUM = 59,
+    DR_LAST_REGNUM = 66,
+    FV0_REGNUM = 67,
+    FV_LAST_REGNUM = 70
   };
 
 extern gdbarch_init_ftype sh64_gdbarch_init;
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 820317b..393f976 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -680,11 +680,11 @@
     }
 
   if (target_has_execution)
-    retval = procfs_ops.deprecated_xfer_memory (memaddr, myaddr, len,
-						dowrite, attrib, target);
+    retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len,
+					dowrite, attrib, target);
   else
-    retval = orig_core_ops.deprecated_xfer_memory (memaddr, myaddr, len,
-						   dowrite, attrib, target);
+    retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
+					   dowrite, attrib, target);
 
   do_cleanups (old_chain);
 
@@ -1014,11 +1014,11 @@
 
       /* FIXME: passing 0 as attrib argument.  */
       if (target_has_execution)
-	cc = procfs_ops.deprecated_xfer_memory (addr, buf, size,
-						dowrite, 0, &procfs_ops);
+	cc = procfs_ops.to_xfer_memory (addr, buf, size,
+					dowrite, 0, &procfs_ops);
       else
-	cc = orig_core_ops.deprecated_xfer_memory (addr, buf, size,
-						   dowrite, 0, &core_ops);
+	cc = orig_core_ops.to_xfer_memory (addr, buf, size,
+					   dowrite, 0, &core_ops);
 
       if (cc < 0)
 	{
@@ -1541,7 +1541,7 @@
   sol_thread_ops.to_fetch_registers = sol_thread_fetch_registers;
   sol_thread_ops.to_store_registers = sol_thread_store_registers;
   sol_thread_ops.to_prepare_to_store = sol_thread_prepare_to_store;
-  sol_thread_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
+  sol_thread_ops.to_xfer_memory = sol_thread_xfer_memory;
   sol_thread_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_thread_ops.to_files_info = sol_thread_files_info;
   sol_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
@@ -1584,7 +1584,7 @@
   sol_core_ops.to_attach = sol_thread_attach;
   sol_core_ops.to_detach = sol_core_detach;
   sol_core_ops.to_fetch_registers = sol_thread_fetch_registers;
-  sol_core_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
+  sol_core_ops.to_xfer_memory = sol_thread_xfer_memory;
   sol_core_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_core_ops.to_files_info = sol_core_files_info;
   sol_core_ops.to_insert_breakpoint = ignore;
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 5237636..872c8ac 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -1,7 +1,7 @@
 /* Handle SunOS shared libraries for GDB, the GNU Debugger.
-
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
-   2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
+   2001, 2004
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -28,7 +28,7 @@
 #include <sys/param.h>
 #include <fcntl.h>
 
-/* SunOS shared libs need the nlist structure.  */
+ /* SunOS shared libs need the nlist structure.  */
 #include <a.out.h>
 #include <link.h>
 
@@ -42,50 +42,6 @@
 #include "bcache.h"
 #include "regcache.h"
 
-/* The shared library implementation found on BSD a.out systems is
-   very similar to the SunOS implementation.  However, the data
-   structures defined in <link.h> are named very differently.  Make up
-   for those differences here.  */
-
-#ifdef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
-
-/* FIXME: Temporary until the equivalent defines have been removed
-   from all nm-*bsd*.h files.  */
-#ifndef link_dynamic
-
-/* Map `struct link_map' and its members.  */
-#define link_map	so_map
-#define lm_addr		som_addr
-#define lm_name		som_path
-#define lm_next		som_next
-
-/* Map `struct link_dynamic_2' and its members.  */
-#define link_dynamic_2	section_dispatch_table
-#define ld_loaded	sdt_loaded
-
-/* Map `struct rtc_symb' and its members.  */
-#define rtc_symb	rt_symbol
-#define rtc_sp		rt_sp
-#define rtc_next	rt_next
-
-/* Map `struct ld_debug' and its members.  */
-#define ld_debug	so_debug
-#define ldd_in_debugger	dd_in_debugger
-#define ldd_bp_addr	dd_bpt_addr
-#define ldd_bp_inst	dd_bpt_shadow
-#define ldd_cp		dd_cc
-
-/* Map `struct link_dynamic' and its members.  */
-#define link_dynamic	_dynamic
-#define ld_version	d_version
-#define ldd		d_debug
-#define ld_un		d_un
-#define ld_2		d_sdt
-
-#endif
-
-#endif
-
 /* Link map info to include in an allocated so_list entry */
 
 struct lm_info
@@ -190,7 +146,7 @@
   objfile->psymbol_cache = bcache_xmalloc ();
   objfile->macro_cache = bcache_xmalloc ();
   obstack_init (&objfile->objfile_obstack);
-  objfile->name = xstrdup ("rt_common");
+  objfile->name = mstrsave (objfile->md, "rt_common");
 
   /* Add this file onto the tail of the linked list of other such files. */
 
diff --git a/gdb/source.c b/gdb/source.c
index f0dc554..b1e9c3874 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -46,16 +46,16 @@
 #include "ui-out.h"
 #include "readline/readline.h"
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifdef CRLF_SOURCE_FILES
 
 /* Define CRLF_SOURCE_FILES in an xm-*.h file if source files on the
    host use \r\n rather than just \n.  Defining CRLF_SOURCE_FILES is
    much faster than defining LSEEK_NOT_LINEAR.  */
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 #define OPEN_MODE (O_RDONLY | O_BINARY)
 #define FDOPEN_MODE FOPEN_RB
 
@@ -674,7 +674,9 @@
   if (!path)
     path = ".";
 
+#if defined(_WIN32) || defined(__CYGWIN__)
   mode |= O_BINARY;
+#endif
 
   if ((opts & OPF_TRY_CWD_FIRST) || IS_ABSOLUTE_PATH (string))
     {
@@ -887,7 +889,7 @@
     {
       char *tmp_fullname;
       tmp_fullname = *fullname;
-      *fullname = xstrdup (tmp_fullname);
+      *fullname = mstrsave (objfile->md, *fullname);
       xfree (tmp_fullname);
     }
   return result;
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 4c33e6d..95f9237 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux SPARC.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -83,12 +83,10 @@
    Otherwise, return 0.  */
 
 CORE_ADDR
-sparc_linux_sigtramp_start (struct frame_info *next_frame,
-			    ULONGEST insn0, ULONGEST insn1)
+sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
   ULONGEST word0, word1;
-  unsigned char buf[8];		/* Two instructions.  */
+  char buf[8];			/* Two instructions.  */
 
   /* We only recognize a signal trampoline if PC is at the start of
      one of the instructions.  We optimize for finding the PC at the
@@ -98,7 +96,7 @@
      sequence, there will be a few trailing readable bytes on the
      stack.  */
 
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
+  if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0)
     return 0;
 
   word0 = extract_unsigned_integer (buf, 4);
@@ -108,7 +106,7 @@
 	return 0;
 
       pc -= 4;
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
+      if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0)
 	return 0;
 
       word0 = extract_unsigned_integer (buf, 4);
@@ -122,35 +120,30 @@
 }
 
 static CORE_ADDR
-sparc32_linux_sigtramp_start (struct frame_info *next_frame)
+sparc32_linux_sigtramp_start (CORE_ADDR pc)
 {
-  return sparc_linux_sigtramp_start (next_frame, LINUX32_SIGTRAMP_INSN0,
+  return sparc_linux_sigtramp_start (pc, LINUX32_SIGTRAMP_INSN0,
 				     LINUX32_SIGTRAMP_INSN1);
 }
 
 static CORE_ADDR
-sparc32_linux_rt_sigtramp_start (struct frame_info *next_frame)
+sparc32_linux_rt_sigtramp_start (CORE_ADDR pc)
 {
-  return sparc_linux_sigtramp_start (next_frame, LINUX32_RT_SIGTRAMP_INSN0,
+  return sparc_linux_sigtramp_start (pc, LINUX32_RT_SIGTRAMP_INSN0,
 				     LINUX32_RT_SIGTRAMP_INSN1);
 }
 
 static int
-sparc32_linux_sigtramp_p (struct frame_info *next_frame)
+sparc32_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-
   /* If we have NAME, we can optimize the search.  The trampolines are
      named __restore and __restore_rt.  However, they aren't dynamically
      exported from the shared C library, so the trampoline may appear to
      be part of the preceding function.  This should always be sigaction,
      __sigaction, or __libc_sigaction (all aliases to the same function).  */
   if (name == NULL || strstr (name, "sigaction") != NULL)
-    return (sparc32_linux_sigtramp_start (next_frame) != 0
-	    || sparc32_linux_rt_sigtramp_start (next_frame) != 0);
+    return (sparc32_linux_sigtramp_start (pc) != 0
+	    || sparc32_linux_rt_sigtramp_start (pc) != 0);
 
   return (strcmp ("__restore", name) == 0
 	  || strcmp ("__restore_rt", name) == 0);
@@ -177,12 +170,13 @@
   regnum = SPARC_O1_REGNUM;
   sigcontext_addr = frame_unwind_register_unsigned (next_frame, regnum);
 
-  addr = sparc32_linux_sigtramp_start (next_frame);
+  cache->pc = frame_pc_unwind (next_frame);
+  addr = sparc32_linux_sigtramp_start (cache->pc);
   if (addr == 0)
     {
       /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
          accordingly.  */
-      addr = sparc32_linux_rt_sigtramp_start (next_frame);
+      addr = sparc32_linux_rt_sigtramp_start (cache->pc);
       if (addr)
 	sigcontext_addr += 128;
       else
@@ -245,13 +239,47 @@
 static const struct frame_unwind *
 sparc32_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
 {
-  if (sparc32_linux_sigtramp_p (next_frame))
+  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  char *name;
+
+  find_pc_partial_function (pc, &name, NULL, NULL);
+  if (sparc32_linux_pc_in_sigtramp (pc, name))
     return &sparc32_linux_sigtramp_frame_unwind;
 
   return NULL;
 }
 
 
+static struct link_map_offsets *
+sparc32_linux_svr4_fetch_link_map_offsets (void)
+{
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = NULL;
+
+  if (lmp == NULL)
+    {
+      lmp = &lmo;
+
+      /* Everything we need is in the first 8 bytes.  */
+      lmo.r_debug_size = 8;
+      lmo.r_map_offset = 4;
+      lmo.r_map_size   = 4;
+
+      /* Everything we need is in the first 20 bytes.  */
+      lmo.link_map_size = 20;
+      lmo.l_addr_offset = 0;
+      lmo.l_addr_size   = 4;
+      lmo.l_name_offset = 4;
+      lmo.l_name_size   = 4;
+      lmo.l_next_offset = 12;
+      lmo.l_next_size   = 4;
+      lmo.l_prev_offset = 16;
+      lmo.l_prev_size   = 4;
+    }
+
+  return lmp;
+}
+
 static void
 sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -266,6 +294,9 @@
   set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
 
   frame_unwind_append_sniffer (gdbarch, sparc32_linux_sigtramp_frame_sniffer);
+
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, sparc32_linux_svr4_fetch_link_map_offsets);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index a3836ce..858e278 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -35,7 +35,6 @@
 
 #include "sparc-tdep.h"
 #include "sparc-nat.h"
-#include "inf-ptrace.h"
 
 /* With some trickery we can use the code in this file for most (if
    not all) ptrace(2) based SPARC systems, which includes SunOS 4,
@@ -305,20 +304,6 @@
   memcpy (readbuf, buf + offset, len);
   return len;
 }
-
-/* Create a prototype generic SPARC target.  The client can override
-   it with local methods.  */
-
-struct target_ops *
-sparc_target (void)
-{
-  struct target_ops *t;
-
-  t = inf_ptrace_target ();
-  t->to_fetch_registers = fetch_inferior_registers;
-  t->to_store_registers = store_inferior_registers;
-  return t;
-}
 
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index 25ecc63..8f99b1e 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -1,6 +1,6 @@
 /* Native-dependent code for SPARC.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -37,9 +37,4 @@
 extern int sparc32_gregset_supplies_p (int regnum);
 extern int sparc32_fpregset_supplies_p (int regnum);
 
-/* Create a prototype generic SPARC target.  The client can override
-   it with local methods.  */
-
-extern struct target_ops *sparc_target (void);
-
 #endif /* sparc-nat.h */
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 7f86e0a..cd78557 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux UltraSPARC.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,9 +22,40 @@
 #include "defs.h"
 #include "gdbarch.h"
 #include "osabi.h"
+#include "solib-svr4.h"
 
 #include "sparc64-tdep.h"
 
+static struct link_map_offsets *
+sparc64_linux_svr4_fetch_link_map_offsets (void)
+{
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = NULL;
+
+  if (lmp == NULL)
+    {
+      lmp = &lmo;
+
+      /* Everything we need is in the first 16 bytes.  */
+      lmo.r_debug_size = 16;
+      lmo.r_map_offset = 8;
+      lmo.r_map_size   = 8;
+
+      /* Everything we need is in the first 40 bytes.  */
+      lmo.link_map_size = 40;
+      lmo.l_addr_offset = 0;
+      lmo.l_addr_size   = 8;
+      lmo.l_name_offset = 8;
+      lmo.l_name_size   = 8;
+      lmo.l_next_offset = 24;
+      lmo.l_next_size   = 8;
+      lmo.l_prev_offset = 32;
+      lmo.l_prev_size   = 8;
+    }
+
+  return lmp;
+}
+
 static void
 sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -35,6 +66,9 @@
 
   /* ... but doesn't have kernel-assisted single-stepping support.  */
   set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
+
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, sparc64_linux_svr4_fetch_link_map_offsets);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
index fe9e006..7d554cf 100644
--- a/gdb/sparc64nbsd-nat.c
+++ b/gdb/sparc64nbsd-nat.c
@@ -21,7 +21,6 @@
 
 #include "defs.h"
 #include "regcache.h"
-#include "target.h"
 
 #include "sparc64-tdep.h"
 #include "sparc-nat.h"
@@ -170,9 +169,6 @@
   sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
   sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;
 
-  /* We've got nothing to add to the generic SPARC target.  */
-  add_target (sparc_target ());
-
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (sparc64nbsd_supply_pcb);
 }
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c
index 4b0eb12..fa663f2 100644
--- a/gdb/sparcnbsd-nat.c
+++ b/gdb/sparcnbsd-nat.c
@@ -20,8 +20,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "gdbcore.h"
 #include "regcache.h"
-#include "target.h"
 
 #include "sparc-tdep.h"
 #include "sparc-nat.h"
@@ -66,9 +66,6 @@
 {
   sparc_gregset = &sparc32nbsd_gregset;
 
-  /* We've got nothing to add to the generic SPARC target.  */
-  add_target (sparc_target ());
-
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (sparc32nbsd_supply_pcb);
 }
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ee9336d..14e8ccd 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2185,10 +2185,6 @@
       add_filename_language (".pas", language_pascal);
       add_filename_language (".p", language_pascal);
       add_filename_language (".pp", language_pascal);
-      add_filename_language (".adb", language_ada);
-      add_filename_language (".ads", language_ada);
-      add_filename_language (".a", language_ada);
-      add_filename_language (".ada", language_ada);
     }
 }
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8ed6d9e..94b6081 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -41,7 +41,6 @@
 #include "source.h"
 #include "filenames.h"		/* for FILENAME_CMP */
 #include "objc-lang.h"
-#include "ada-lang.h"
 
 #include "hashtab.h"
 
@@ -635,24 +634,17 @@
 char *
 symbol_natural_name (const struct general_symbol_info *gsymbol)
 {
-  switch (gsymbol->language) 
+  if ((gsymbol->language == language_cplus
+       || gsymbol->language == language_java
+       || gsymbol->language == language_objc)
+      && (gsymbol->language_specific.cplus_specific.demangled_name != NULL))
     {
-    case language_cplus:
-    case language_java:
-    case language_objc:
-      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
-	return gsymbol->language_specific.cplus_specific.demangled_name;
-      break;
-    case language_ada:
-      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
-	return gsymbol->language_specific.cplus_specific.demangled_name;
-      else
-	return ada_decode_symbol (gsymbol);
-      break;
-    default:
-      break;
+      return gsymbol->language_specific.cplus_specific.demangled_name;
     }
-  return gsymbol->name;
+  else
+    {
+      return gsymbol->name;
+    }
 }
 
 /* Return the demangled name for a symbol based on the language for
@@ -660,24 +652,13 @@
 char *
 symbol_demangled_name (struct general_symbol_info *gsymbol)
 {
-  switch (gsymbol->language) 
-    {
-    case language_cplus:
-    case language_java:
-    case language_objc:
-      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
-	return gsymbol->language_specific.cplus_specific.demangled_name;
-      break;
-    case language_ada:
-      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
-	return gsymbol->language_specific.cplus_specific.demangled_name;
-      else
-	return ada_decode_symbol (gsymbol);
-      break;
-    default:
-      break;
-    }
-  return NULL;
+  if (gsymbol->language == language_cplus
+      || gsymbol->language == language_java
+      || gsymbol->language == language_objc)
+    return gsymbol->language_specific.cplus_specific.demangled_name;
+
+  else 
+    return NULL;
 }
 
 /* Return the search name of a symbol---generally the demangled or
@@ -685,10 +666,7 @@
    If there is no distinct demangled name, then returns the same value 
    (same pointer) as SYMBOL_LINKAGE_NAME. */
 char *symbol_search_name (const struct general_symbol_info *gsymbol) {
-  if (gsymbol->language == language_ada)
-    return gsymbol->name;
-  else
-    return symbol_natural_name (gsymbol);
+  return symbol_natural_name (gsymbol);
 }
 
 /* Initialize the structure fields to zero values.  */
diff --git a/gdb/target.c b/gdb/target.c
index 81389a7..0e76e71e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -86,8 +86,6 @@
 
 static void init_dummy_target (void);
 
-static struct target_ops debug_target;
-
 static void debug_to_open (char *, int);
 
 static void debug_to_close (int);
@@ -108,9 +106,8 @@
 
 static void debug_to_prepare_to_store (void);
 
-static int deprecated_debug_xfer_memory (CORE_ADDR, char *, int, int,
-					 struct mem_attrib *,
-					 struct target_ops *);
+static int debug_to_xfer_memory (CORE_ADDR, char *, int, int,
+				 struct mem_attrib *, struct target_ops *);
 
 static void debug_to_files_info (struct target_ops *);
 
@@ -130,7 +127,7 @@
 
 static int debug_to_stopped_by_watchpoint (void);
 
-static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
+static CORE_ADDR debug_to_stopped_data_address (void);
 
 static int debug_to_region_size_ok_for_hw_watchpoint (int);
 
@@ -162,12 +159,6 @@
 
 static void debug_to_stop (void);
 
-/* NOTE: cagney/2004-09-29: Many targets reference this variable in
-   wierd and mysterious ways.  Putting the variable here lets those
-   wierd and mysterious ways keep building while they are being
-   converted to the inferior inheritance structure.  */
-struct target_ops deprecated_child_ops;
-
 /* Pointer to array of target architecture structures; the size of the
    array; the current index into the array; the allocated size of the 
    array.  */
@@ -388,10 +379,11 @@
       INHERIT (to_disconnect, t);
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
+      INHERIT (to_post_wait, t);
       INHERIT (to_fetch_registers, t);
       INHERIT (to_store_registers, t);
       INHERIT (to_prepare_to_store, t);
-      INHERIT (deprecated_xfer_memory, t);
+      INHERIT (to_xfer_memory, t);
       INHERIT (to_files_info, t);
       INHERIT (to_insert_breakpoint, t);
       INHERIT (to_remove_breakpoint, t);
@@ -489,6 +481,9 @@
   de_fault (to_wait, 
 	    (ptid_t (*) (ptid_t, struct target_waitstatus *)) 
 	    noprocess);
+  de_fault (to_post_wait, 
+	    (void (*) (ptid_t, int)) 
+	    target_ignore);
   de_fault (to_fetch_registers, 
 	    (void (*) (int)) 
 	    target_ignore);
@@ -498,7 +493,7 @@
   de_fault (to_prepare_to_store, 
 	    (void (*) (void)) 
 	    noprocess);
-  de_fault (deprecated_xfer_memory, 
+  de_fault (to_xfer_memory, 
 	    (int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *)) 
 	    nomemory);
   de_fault (to_files_info, 
@@ -527,7 +522,7 @@
 	    (int (*) (void))
 	    return_zero);
   de_fault (to_stopped_data_address,
-	    (int (*) (struct target_ops *, CORE_ADDR *))
+	    (CORE_ADDR (*) (void))
 	    return_zero);
   de_fault (to_region_size_ok_for_hw_watchpoint,
 	    default_region_size_ok_for_hw_watchpoint);
@@ -784,7 +779,7 @@
       tlen = MIN (len, 4 - (memaddr & 3));
       offset = memaddr & 3;
 
-      errcode = target_read_memory (memaddr & ~3, buf, 4);
+      errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0);
       if (errcode != 0)
 	{
 	  /* The transfer request might have crossed the boundary to an
@@ -792,7 +787,7 @@
 	     a single byte.  */
 	  tlen = 1;
 	  offset = 0;
-	  errcode = target_read_memory (memaddr, buf, 1);
+	  errcode = target_xfer_memory (memaddr, buf, 1, 0);
 	  if (errcode != 0)
 	    goto done;
 	}
@@ -843,147 +838,6 @@
   return NULL;
 }
 
-/* Return non-zero when the target vector has supplied an xfer_partial
-   method and it, rather than xfer_memory, should be used.  */
-static int
-target_xfer_partial_p (void)
-{
-  return (target_stack != NULL
-	  && target_stack->to_xfer_partial != default_xfer_partial);
-}
-
-static LONGEST
-target_xfer_partial (struct target_ops *ops,
-		     enum target_object object, const char *annex,
-		     void *readbuf, const void *writebuf,
-		     ULONGEST offset, LONGEST len)
-{
-  LONGEST retval;
-
-  gdb_assert (ops->to_xfer_partial != NULL);
-  retval = ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
-				 offset, len);
-  if (targetdebug)
-    {
-      const unsigned char *myaddr = NULL;
-
-      fprintf_unfiltered (gdb_stdlog,
-			  "%s:target_xfer_partial (%d, %s, 0x%lx,  0x%lx,  0x%s, %s) = %s",
-			  ops->to_shortname,
-			  (int) object,
-			  (annex ? annex : "(null)"),
-			  (long) readbuf, (long) writebuf,
-			  paddr_nz (offset), paddr_d (len), paddr_d (retval));
-
-      if (readbuf)
-	myaddr = readbuf;
-      if (writebuf)
-	myaddr = writebuf;
-      if (retval > 0 && myaddr != NULL)
-	{
-	  int i;
-	  
-	  fputs_unfiltered (", bytes =", gdb_stdlog);
-	  for (i = 0; i < retval; i++)
-	    {
-	      if ((((long) &(myaddr[i])) & 0xf) == 0)
-		{
-		  if (targetdebug < 2 && i > 0)
-		    {
-		      fprintf_unfiltered (gdb_stdlog, " ...");
-		      break;
-		    }
-		  fprintf_unfiltered (gdb_stdlog, "\n");
-		}
-	      
-	      fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff);
-	    }
-	}
-      
-      fputc_unfiltered ('\n', gdb_stdlog);
-    }
-  return retval;
-}
-
-/* Attempt a transfer all LEN bytes starting at OFFSET between the
-   inferior's KIND:ANNEX space and GDB's READBUF/WRITEBUF buffer.  If
-   the transfer succeeds, return zero, otherwize the host ERRNO is
-   returned.
-
-   The inferior is formed from several layers.  In the case of
-   corefiles, inf-corefile is layered above inf-exec and a request for
-   text (corefiles do not include text pages) will be first sent to
-   the core-stratum, fail, and then sent to the object-file where it
-   will succeed.
-
-   NOTE: cagney/2004-09-30:
-
-   The old code tried to use four separate mechanisms for mapping an
-   object:offset:len tuple onto an inferior and its address space: the
-   target stack; the inferior's TO_SECTIONS; solib's SO_LIST;
-   overlays.
-
-   This is stupid.
-
-   The code below is instead using a single mechanism (currently
-   strata).  If that mechanism proves insufficient then re-factor it
-   implementing another singluar mechanism (for instance, a generic
-   object:annex onto inferior:object:annex say).  */
-
-static LONGEST
-xfer_using_stratum (enum target_object object, const char *annex,
-		    ULONGEST offset, LONGEST len, void *readbuf,
-		    const void *writebuf)
-{
-  LONGEST xfered;
-  struct target_ops *target;
-
-  /* Always successful.  */
-  if (len == 0)
-    return 0;
-  /* Never successful.  */
-  if (target_stack == NULL)
-    return EIO;
-
-  target = target_stack;
-  while (1)
-    {
-      xfered = target_xfer_partial (target, object, annex,
-				    readbuf, writebuf, offset, len);
-      if (xfered > 0)
-	{
-	  /* The partial xfer succeeded, update the counts, check that
-	     the xfer hasn't finished and if it hasn't set things up
-	     for the next round.  */
-	  len -= xfered;
-	  if (len <= 0)
-	    return 0;
-	  offset += xfered;
-	  if (readbuf != NULL)
-	    readbuf = (bfd_byte *) readbuf + xfered;
-	  if (writebuf != NULL)
-	    writebuf = (bfd_byte *) writebuf + xfered;
-	  target = target_stack;
-	}
-      else if (xfered < 0)
-	{
-	  /* Something totally screwed up, abandon the attempt to
-	     xfer.  */
-	  if (errno)
-	    return errno;
-	  else
-	    return EIO;
-	}
-      else
-	{
-	  /* This "stratum" didn't work, try the next one down.  */
-	  target = target->beneath;
-	  if (target == NULL)
-	    return EIO;
-	}
-    }
-}
-
 /* Read LEN bytes of target memory at address MEMADDR, placing the results in
    GDB's memory at MYADDR.  Returns either 0 for success or an errno value
    if any error occurs.
@@ -997,38 +851,15 @@
 int
 target_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
-  if (target_xfer_partial_p ())
-    return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
-			       memaddr, len, myaddr, NULL);
-  else
-    return target_xfer_memory (memaddr, myaddr, len, 0);
+  return target_xfer_memory (memaddr, myaddr, len, 0);
 }
 
 int
 target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
-  if (target_xfer_partial_p ())
-    return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
-			       memaddr, len, NULL, myaddr);
-  else
-    return target_xfer_memory (memaddr, myaddr, len, 1);
+  return target_xfer_memory (memaddr, myaddr, len, 1);
 }
 
-#ifndef target_stopped_data_address_p
-int
-target_stopped_data_address_p (struct target_ops *target)
-{
-  if (target->to_stopped_data_address
-      == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero)
-    return 0;
-  if (target->to_stopped_data_address == debug_to_stopped_data_address
-      && (debug_target.to_stopped_data_address
-	  == (int (*) (struct target_ops *, CORE_ADDR *)) return_zero))
-    return 0;
-  return 1;
-}
-#endif
-
 static int trust_readonly = 0;
 
 /* Move memory to or from the targets.  The top target gets priority;
@@ -1048,8 +879,8 @@
   if (len == 0)
     return 0;
 
-  /* deprecated_xfer_memory is not guaranteed to set errno, even when
-     it returns 0.  */
+  /* to_xfer_memory is not guaranteed to set errno, even when it returns
+     0.  */
   errno = 0;
 
   if (!write && trust_readonly)
@@ -1066,7 +897,7 @@
     }
 
   /* The quick case is that the top target can handle the transfer.  */
-  res = current_target.deprecated_xfer_memory
+  res = current_target.to_xfer_memory
     (memaddr, myaddr, len, write, attrib, &current_target);
 
   /* If res <= 0 then we call it again in the loop.  Ah well. */
@@ -1077,7 +908,7 @@
 	  if (!t->to_has_memory)
 	    continue;
 
-	  res = t->deprecated_xfer_memory (memaddr, myaddr, len, write, attrib, t);
+	  res = t->to_xfer_memory (memaddr, myaddr, len, write, attrib, t);
 	  if (res > 0)
 	    break;		/* Handled all or part of xfer */
 	  if (t->to_has_all_memory)
@@ -1232,21 +1063,13 @@
 int
 target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
 {
-  if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-				buf, NULL, memaddr, len);
-  else
-    return target_xfer_memory_partial (memaddr, buf, len, 0, err);
+  return target_xfer_memory_partial (memaddr, buf, len, 0, err);
 }
 
 int
 target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
 {
-  if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-				NULL, buf, memaddr, len);
-  else
-    return target_xfer_memory_partial (memaddr, buf, len, 1, err);
+  return target_xfer_memory_partial (memaddr, buf, len, 1, err);
 }
 
 /* More generic transfers.  */
@@ -1257,9 +1080,9 @@
 		      const void *writebuf, ULONGEST offset, LONGEST len)
 {
   if (object == TARGET_OBJECT_MEMORY
-      && ops->deprecated_xfer_memory != NULL)
-    /* If available, fall back to the target's
-       "deprecated_xfer_memory" method.  */
+      && ops->to_xfer_memory != NULL)
+    /* If available, fall back to the target's "to_xfer_memory"
+       method.  */
     {
       int xfered = -1;
       errno = 0;
@@ -1268,25 +1091,25 @@
 	  void *buffer = xmalloc (len);
 	  struct cleanup *cleanup = make_cleanup (xfree, buffer);
 	  memcpy (buffer, writebuf, len);
-	  xfered = ops->deprecated_xfer_memory (offset, buffer, len,
-						1/*write*/, NULL, ops);
+	  xfered = ops->to_xfer_memory (offset, buffer, len, 1/*write*/, NULL,
+					ops);
 	  do_cleanups (cleanup);
 	}
       if (readbuf != NULL)
-	xfered = ops->deprecated_xfer_memory (offset, readbuf, len, 0/*read*/,
-					      NULL, ops);
+	xfered = ops->to_xfer_memory (offset, readbuf, len, 0/*read*/, NULL,
+				      ops);
       if (xfered > 0)
 	return xfered;
       else if (xfered == 0 && errno == 0)
-	/* "deprecated_xfer_memory" uses 0, cross checked against
-           ERRNO as one indication of an error.  */
+	/* "to_xfer_memory" uses 0, cross checked against ERRNO as one
+           indication of an error.  */
 	return 0;
       else
 	return -1;
     }
   else if (ops->beneath != NULL)
-    return target_xfer_partial (ops->beneath, object, annex,
-				readbuf, writebuf, offset, len);
+    return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+					  readbuf, writebuf, offset, len);
   else
     return -1;
 }
@@ -1303,7 +1126,8 @@
 		     const char *annex, void *buf,
 		     ULONGEST offset, LONGEST len)
 {
-  return target_xfer_partial (ops, object, annex, buf, NULL, offset, len);
+  gdb_assert (ops->to_xfer_partial != NULL);
+  return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
 }
 
 LONGEST
@@ -1312,7 +1136,8 @@
 		      const char *annex, const void *buf,
 		      ULONGEST offset, LONGEST len)
 {
-  return target_xfer_partial (ops, object, annex, NULL, buf, offset, len);
+  gdb_assert (ops->to_xfer_partial != NULL);
+  return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
 }
 
 /* Wrappers to perform the full transfer.  */
@@ -1796,6 +1621,9 @@
   dummy_target.to_magic = OPS_MAGIC;
 }
 
+
+static struct target_ops debug_target;
+
 static void
 debug_to_open (char *args, int from_tty)
 {
@@ -1913,6 +1741,15 @@
 }
 
 static void
+debug_to_post_wait (ptid_t ptid, int status)
+{
+  debug_target.to_post_wait (ptid, status);
+
+  fprintf_unfiltered (gdb_stdlog, "target_post_wait (%d, %d)\n",
+		      PIDGET (ptid), status);
+}
+
+static void
 debug_print_register (const char * func, int regno)
 {
   fprintf_unfiltered (gdb_stdlog, "%s ", func);
@@ -1965,14 +1802,14 @@
 }
 
 static int
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
-			      int write, struct mem_attrib *attrib,
-			      struct target_ops *target)
+debug_to_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		      struct mem_attrib *attrib,
+		      struct target_ops *target)
 {
   int retval;
 
-  retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write,
-						attrib, target);
+  retval = debug_target.to_xfer_memory (memaddr, myaddr, len, write,
+					attrib, target);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
@@ -2084,17 +1921,16 @@
   return retval;
 }
 
-static int
-debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
+static CORE_ADDR
+debug_to_stopped_data_address (void)
 {
-  int retval;
+  CORE_ADDR retval;
 
-  retval = debug_target.to_stopped_data_address (target, addr);
+  retval = debug_target.to_stopped_data_address ();
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_stopped_data_address ([0x%lx]) = %ld\n",
-		      (unsigned long)*addr,
-		      (unsigned long)retval);
+		      "target_stopped_data_address () = 0x%lx\n",
+		      (unsigned long) retval);
   return retval;
 }
 
@@ -2431,6 +2267,25 @@
   fprintf_unfiltered (gdb_stdlog, "target_stop ()\n");
 }
 
+static LONGEST
+debug_to_xfer_partial (struct target_ops *ops, enum target_object object,
+		       const char *annex, void *readbuf, const void *writebuf,
+		       ULONGEST offset, LONGEST len)
+{
+  LONGEST retval;
+
+  retval = debug_target.to_xfer_partial (&debug_target, object, annex,
+					 readbuf, writebuf, offset, len);
+
+  fprintf_unfiltered (gdb_stdlog,
+		      "target_xfer_partial (%d, %s, 0x%lx,  0x%lx,  0x%s, %s) = %s\n",
+		      (int) object, (annex ? annex : "(null)"),
+		      (long) readbuf, (long) writebuf, paddr_nz (offset),
+		      paddr_d (len), paddr_d (retval));
+
+  return retval;
+}
+
 static void
 debug_to_rcmd (char *command,
 	       struct ui_file *outbuf)
@@ -2485,10 +2340,11 @@
   current_target.to_disconnect = debug_to_disconnect;
   current_target.to_resume = debug_to_resume;
   current_target.to_wait = debug_to_wait;
+  current_target.to_post_wait = debug_to_post_wait;
   current_target.to_fetch_registers = debug_to_fetch_registers;
   current_target.to_store_registers = debug_to_store_registers;
   current_target.to_prepare_to_store = debug_to_prepare_to_store;
-  current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory;
+  current_target.to_xfer_memory = debug_to_xfer_memory;
   current_target.to_files_info = debug_to_files_info;
   current_target.to_insert_breakpoint = debug_to_insert_breakpoint;
   current_target.to_remove_breakpoint = debug_to_remove_breakpoint;
@@ -2527,6 +2383,7 @@
   current_target.to_thread_alive = debug_to_thread_alive;
   current_target.to_find_new_threads = debug_to_find_new_threads;
   current_target.to_stop = debug_to_stop;
+  current_target.to_xfer_partial = debug_to_xfer_partial;
   current_target.to_rcmd = debug_to_rcmd;
   current_target.to_enable_exception_callback = debug_to_enable_exception_callback;
   current_target.to_get_current_exception_event = debug_to_get_current_exception_event;
diff --git a/gdb/target.h b/gdb/target.h
index 84c284b..92becca 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -304,6 +304,7 @@
     void (*to_disconnect) (char *, int);
     void (*to_resume) (ptid_t, int, enum target_signal);
     ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
+    void (*to_post_wait) (ptid_t, int);
     void (*to_fetch_registers) (int);
     void (*to_store_registers) (int);
     void (*to_prepare_to_store) (void);
@@ -324,15 +325,12 @@
 
        negative (call its absolute value N) means that we cannot
        transfer right at MEMADDR, but we could transfer at least
-       something at MEMADDR + N.
+       something at MEMADDR + N.  */
 
-       NOTE: cagney/2004-10-01: This has been entirely superseeded by
-       to_xfer_partial and inferior inheritance.  */
-
-    int (*deprecated_xfer_memory) (CORE_ADDR memaddr, char *myaddr,
-				   int len, int write,
-				   struct mem_attrib *attrib,
-				   struct target_ops *target);
+    int (*to_xfer_memory) (CORE_ADDR memaddr, char *myaddr,
+			   int len, int write,
+			   struct mem_attrib *attrib,
+			   struct target_ops *target);
 
     void (*to_files_info) (struct target_ops *);
     int (*to_insert_breakpoint) (CORE_ADDR, char *);
@@ -344,7 +342,7 @@
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
     int to_have_continuable_watchpoint;
-    int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
+    CORE_ADDR (*to_stopped_data_address) (void);
     int (*to_region_size_ok_for_hw_watchpoint) (int);
     void (*to_terminal_init) (void);
     void (*to_terminal_inferior) (void);
@@ -509,6 +507,19 @@
 #define	target_wait(ptid, status)		\
      (*current_target.to_wait) (ptid, status)
 
+/* The target_wait operation waits for a process event to occur, and
+   thereby stop the process.
+
+   On some targets, certain events may happen in sequences.  gdb's
+   correct response to any single event of such a sequence may require
+   knowledge of what earlier events in the sequence have been seen.
+
+   This operation provides a target-specific hook that allows the
+   necessary bookkeeping to be performed to track such sequences.  */
+
+#define target_post_wait(ptid, status) \
+     (*current_target.to_post_wait) (ptid, status)
+
 /* Fetch at least register REGNO, or all regs if regno == -1.  No result.  */
 
 #define	target_fetch_registers(regno)	\
@@ -567,6 +578,8 @@
 extern void child_post_attach (int);
 #endif
 
+extern void child_post_wait (ptid_t, int);
+
 extern void child_post_startup_inferior (ptid_t);
 
 extern void child_acknowledge_created_inferior (int);
@@ -1070,14 +1083,9 @@
      (*current_target.to_remove_hw_breakpoint) (addr, save)
 #endif
 
-extern int target_stopped_data_address_p (struct target_ops *);
-
 #ifndef target_stopped_data_address
-#define target_stopped_data_address(target, x) \
-    (*target.to_stopped_data_address) (target, x)
-#else
-/* Horrible hack to get around existing macros :-(.  */
-#define target_stopped_data_address_p(CURRENT_TARGET) (1)
+#define target_stopped_data_address() \
+    (*current_target.to_stopped_data_address) ()
 #endif
 
 /* This will only be defined by a target that supports catching vfork events,
@@ -1229,6 +1237,4 @@
 /* Blank target vector entries are initialized to target_ignore. */
 void target_ignore (void);
 
-extern struct target_ops deprecated_child_ops;
-
 #endif /* !defined (TARGET_H) */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ba5c69..73d79a9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,90 +1,3 @@
-2004-10-14  Andrew Cagney  <cagney@gnu.org>
-
-	* gdb.mi/gdb701.c (main): Return 0.
-
-2004-10-13  Daniel Jacobowitz  <dan@debian.org>
-
-	* gdb.dwarf2/dw2-intercu.S, gdb.dwarf2/dw2-intercu.exp: New files.
-
-2004-10-12  Jeff Johnston  <jjohnstn@redhat.com>
-
-	* gdb.threads/schedlock.c: Add comment markers to use to find
-	line numbers.
-	* gdb.threads/schedlock.exp: Adjust regex to handle the new
-	comments.
-	* gdb.threads/watchthreads.exp: Use gdb_get_line_number to find
-	breakpoint lines.
-
-2004-10-12  Daniel Jacobowitz  <dan@debian.org>
-
-	* gdb.dwarf2/dw2-basic.exp: Run on Hurd also.
-
-2004-10-12  Daniel Jacobowitz  <dan@debian.org>
-
-	* configure.in: Add gdb.dwarf2.
-	* configure: Regenerated.
-	* Makefile.in: Add gdb.dwarf2.
-	* gdb.dwarf2/Makefile.in, gdb.dwarf2/dw2-basic.S,
-	gdb.dwarf2/dw2-basic.exp, gdb.dwarf2/main.c,
-	gdb.dwarf2/file1.txt: New files.
-
-2004-10-11  Orjan Friberg  <orjanf@axis.com>
-
-	* gdb.threads/bp_in_thread.exp: Use runto_main and "continue" instead 
-	of "run", since the latter doesn't work with remote targets.  Adjust
-	the breakpoint numbering accordingly.
-	* gdb.threads/pthread_cond_wait.exp: Ditto.
-
-2004-10-08  Michael Chastain  <mec.gnu@mindspring.com>
-
-	* gdb.base/overlays.exp: Update copyright years.
-
-2004-10-08  Kei Sakamoto  <sakamoto.kei@renesas.com>
-
-	* gdb.base/overlays.exp: Disable if target is Linux.
-
-2004-10-06  Felix Lee  <felix+log1@specifixinc.com>
-
-	* config/gdbserver.exp (gdb_load): Use right filename on remote.
-
-2004-10-05  Kei Sakamoto  <sakamoto.kei@renesas.com>
-
-	* gdb.asm/asm-source.exp: Add m32r-linux target.
-	* gdb.asm/m32r-linux.inc: New file.
-
-2004-09-24  Andrew Cagney  <cagney@redhat.com>
-	    David Anderson <anderson@redhat.com>
-
-	* gdb.base/bigcore.exp (extract_heap): If the expect "file size"
-	command fails, assume things will work.
-	* gdb.base/bigcore.c: Include <sys/stat.h> and <fcntl.h>.
-	(_GNU_SOURCE): Define.
-	(print_unsigned, print_hex): Change parameter to "long long".
-	(print_byte_count): New function, use to print byte counts.
-	(large_off_t, large_lseek, O_LARGEFILE): Define dependant on
-	O_LARGEFILE.
-	(main): Compute an upper bound on a corefile in max_core_size.
-	Limit memory chunk size to max_core_size.  Limit total memory
-	allocated to max_core_size.
-
-2004-09-23  Andrew Cagney  <cagney@gnu.org>
-
-	* gdb.base/bigcore.exp: Replace the code that creates a corefile
-	from a separate process with code that creates a corefile by
-	making the inferior dump core.
-
-2004-09-23  Mark Kettenis  <kettenis@gnu.org>
-
-	* gdb.base/sigstep.exp: Avoid comments withing gdb_test_multiple
-	block.
-
-2004-09-23  Michael Chastain  <mec.gnu@mindspring.com>
-
-	* gdb.base/constvars.exp (local_compiler_xfail_check_2):
-	New proc.  Accept both gcc 3.x.x and gcc 4.x.x.
-	* gdb.base/volatile.exp (local_compiler_xfail_check_2):
-	Likewise.
-
 2004-09-20  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* gdb.java/jprint.exp: New test case for java inferior call.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 5aa8262..d9be89c 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -36,7 +36,6 @@
 SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
 ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
-	gdb.dwarf2 \
 	gdb.fortran gdb.java gdb.mi gdb.objc gdb.threads gdb.trace \
 	$(SUBDIRS)
 
diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp
index 6dc6b23..ed812f8 100644
--- a/gdb/testsuite/config/gdbserver.exp
+++ b/gdb/testsuite/config/gdbserver.exp
@@ -207,7 +207,7 @@
 	}
     }
 
-    set res [gdbserver_gdb_load $server_exec]
+    set res [gdbserver_gdb_load $host_exec]
     set protocol [lindex $res 0]
     set gdbport [lindex $res 1]
 
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 43a843f..271e11d 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -1052,8 +1052,8 @@
 trap 'rm -fr `echo "Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
-  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+  gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
@@ -1149,8 +1149,8 @@
 CONFIG_FILES=\${CONFIG_FILES-"Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
-  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+  gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in
index 02c0a04..8b90e04 100644
--- a/gdb/testsuite/configure.in
+++ b/gdb/testsuite/configure.in
@@ -121,6 +121,6 @@
 AC_OUTPUT([Makefile \
   gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
-  gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
+  gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+  gdb.java/Makefile gdb.mi/Makefile \
   gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile])
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index fcd0ae0..e2c9e8a 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -71,9 +71,6 @@
     "i\[3456\]86-*-*" {
         set asm-arch i386
     }
-    "m32r*-linux*" {
-        set asm-arch m32r-linux
-    }
     "m32r*-*" {
         set asm-arch m32r
         append link-flags "--whole-archive -lgloss --no-whole-archive"
diff --git a/gdb/testsuite/gdb.asm/m32r-linux.inc b/gdb/testsuite/gdb.asm/m32r-linux.inc
deleted file mode 100644
index 64d6504..0000000
--- a/gdb/testsuite/gdb.asm/m32r-linux.inc
+++ /dev/null
@@ -1,34 +0,0 @@
-	comment "subroutine prologue"
-	.macro gdbasm_enter
-	push fp -> push lr
-	addi sp,#-4 -> mv fp,sp
-	.endm
-
-	comment "subroutine epilogue"
-	.macro gdbasm_leave
-	addi sp,#4 -> pop lr
-	pop fp -> jmp lr
-	.endm
-
-	.macro gdbasm_call subr
-	bl	\subr
-	.endm
-
-	.macro gdbasm_several_nops
-	nop
-	nop
-	nop
-	nop
-	.endm
-
-	comment "exit (0)"
-	.macro gdbasm_exit0
-	ldi r0,#1 -> ldi r1,#0
-	ldi r2,#0 -> ldi r3,#0
-	trap #0 -> nop
-	.endm
-
-	comment "crt0 startup"
-	.macro gdbasm_startup
-	ldi fp,#0
-	.endm
diff --git a/gdb/testsuite/gdb.base/bigcore.c b/gdb/testsuite/gdb.base/bigcore.c
index 9215b5a..2a8bb07 100644
--- a/gdb/testsuite/gdb.base/bigcore.c
+++ b/gdb/testsuite/gdb.base/bigcore.c
@@ -19,14 +19,9 @@
    Please email any bugs, comments, and/or additions to this file to:
    bug-gdb@prep.ai.mit.edu  */
 
-/* Get 64-bit stuff if on a GNU system.  */
-#define _GNU_SOURCE
-
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -48,7 +43,7 @@
 }
 
 static void
-print_unsigned (unsigned long long u)
+print_unsigned (unsigned long u)
 {
   if (u >= 10)
     print_unsigned (u / 10);
@@ -56,7 +51,7 @@
 }
 
 static void
-print_hex (unsigned long long u)
+print_hex (unsigned long u)
 {
   if (u >= 16)
     print_hex (u / 16);
@@ -77,16 +72,6 @@
   print_hex ((unsigned long) a);
 }
 
-static void
-print_byte_count (unsigned long long u)
-{
-  print_unsigned (u);
-  print_string (" (");
-  print_string ("0x");
-  print_hex (u);
-  print_string (") bytes");
-}
-
 /* Print the current values of RESOURCE.  */
 
 static void
@@ -137,20 +122,10 @@
 
 static unsigned long bytes_allocated;
 
-#ifdef O_LARGEFILE
-#define large_off_t off64_t
-#define large_lseek lseek64
-#else
-#define large_off_t off_t
-#define O_LARGEFILE 0
-#define large_lseek lseek
-#endif
-
 int
 main ()
 {
   size_t max_chunk_size;
-  large_off_t max_core_size;
 
   /* Try to expand all the resource limits beyond the point of sanity
      - we're after the biggest possible core file.  */
@@ -169,46 +144,14 @@
   maximize_rlimit (RLIMIT_AS, "stack");
 #endif
 
-  print_string ("Maximize allocation limits ...\n");
-
-  /* Compute the largest possible corefile size.  No point in trying
-     to create a corefile larger than the largest file supported by
-     the file system.  What about 64-bit lseek64?  */
-  {
-    int fd;
-    large_off_t tmp;
-    unlink ("bigcore.corefile");
-    fd = open ("bigcore.corefile", O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE);
-    for (tmp = 1; tmp > 0; tmp <<= 1)
-      {
-	if (large_lseek (fd, tmp, SEEK_SET) > 0)
-	  max_core_size = tmp;
-      }
-    close (fd);
-  }
-  
   /* Compute an initial chunk size.  The math is dodgy but it works
-     for the moment.  Perhaphs there's a constant around somewhere.
-     Limit this to max_core_size bytes - no point in trying to
-     allocate more than can be written to the corefile.  */
+     for the moment.  Perhaphs there's a constant around somewhere.  */
   {
     size_t tmp;
-    for (tmp = 1; tmp > 0 && tmp < max_core_size; tmp <<= 1)
+    for (tmp = 1; tmp > 0; tmp <<= 1)
       max_chunk_size = tmp;
   }
 
-  print_string ("  core: ");
-  print_byte_count (max_core_size);
-  print_string ("\n");
-  print_string ("  chunk: ");
-  print_byte_count (max_chunk_size);
-  print_string ("\n");
-  print_string ("  large? ");
-  if (O_LARGEFILE)
-    print_string ("yes\n");
-  else
-    print_string ("no\n");
-
   /* Allocate as much memory as possible creating a linked list of
      each section.  The linking ensures that some, but not all, the
      memory is allocated.  NB: Some kernels handle this efficiently -
@@ -230,10 +173,9 @@
       {
 	unsigned long count = 0;
 	print_string ("  ");
-	print_byte_count (chunk_size);
-	print_string (" ... ");
-	while (bytes_allocated + (1 + count) * chunk_size
-	       < max_core_size)
+	print_unsigned (chunk_size);
+	print_string (" bytes ... ");
+	while (1)
 	  {
 	    struct list *chunk = malloc (chunk_size);
 	    if (chunk == NULL)
@@ -252,7 +194,7 @@
 	bytes_allocated += chunk_size * count;
       }
     print_string ("Total of ");
-    print_byte_count (bytes_allocated);
+    print_unsigned (bytes_allocated);
     print_string (" bytes ");
     print_unsigned (chunks_allocated);
     print_string (" chunks\n");
diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp
index af3098c..0a55eae 100644
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -65,6 +65,36 @@
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
+# Create a core file named "TESTFILE.corefile" rather than just
+# "core", to avoid problems with sys admin types that like to
+# regularly prune all files named "core" from the system.
+
+# Some systems append "core" to the name of the program; others append
+# the name of the program to "core"; still others (like Linux, as of
+# May 2003) create cores named "core.PID".  In the latter case, we
+# could have many core files lying around, and it may be difficult to
+# tell which one is ours, so let's run the program in a subdirectory.
+
+set found 0
+set coredir "${objdir}/${subdir}/coredir.[getpid]"
+file mkdir $coredir
+catch "system \"(cd ${coredir}; ${binfile}; true) >/dev/null 2>&1\""
+set names [glob -nocomplain -directory $coredir *core*]
+if {[llength $names] == 1} {
+    set file [file join $coredir [lindex $names 0]]
+    remote_exec build "mv $file $corefile"
+    set found 1
+}
+
+# Try to clean up after ourselves. 
+remote_file build delete [file join $coredir coremmap.data]
+remote_exec build "rmdir $coredir"
+    
+if { $found == 0  } {
+    warning "can't generate a core file - core tests suppressed - check ulimit -c"
+    return 0
+}
+
 # Run GDB on the bigcore program up-to where it will dump core.
 
 gdb_exit
@@ -83,6 +113,28 @@
 gdb_test continue ".*print_string.*"
 gdb_test next ".*0 = 0.*"
 
+# Check that the corefile is plausibly large enough.  We're trying to
+# detect the case where the operating system has truncated the file
+# just before signed wraparound.  TCL, unfortunately, has a similar
+# problem - so use catch.  It can handle the "bad" size but not necessarily
+# the "good" one.  And we must use GDB for the comparison, similarly.
+
+if {[catch {file size $corefile} core_size] == 0} {
+    set core_ok 0
+    gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
+	-re " = 1\r\n$gdb_prompt $" {
+	    pass "check core size"
+	    set core_ok 1
+	}
+	-re " = 0\r\n$gdb_prompt $" {
+	    xfail "check core size (system does not support large corefiles)"
+	}
+    }
+    if {$core_ok == 0} {
+	return 0
+    }
+}
+
 # Traverse part of bigcore's linked list of memory chunks (forward or
 # backward), saving each chunk's address.
 
@@ -118,79 +170,6 @@
 set next_heap [extract_heap next]
 set prev_heap [extract_heap prev]
 
-# Now create a core dump
-
-# Rename the core file to "TESTFILE.corefile" rather than just "core",
-# to avoid problems with sys admin types that like to regularly prune
-# all files named "core" from the system.
-
-# Some systems append "core" to the name of the program; others append
-# the name of the program to "core"; still others (like Linux, as of
-# May 2003) create cores named "core.PID".
-
-# Save the process ID.  Some systems dump the core into core.PID.
-set test "grab pid"
-gdb_test_multiple "info program" $test {
-    -re "child process (\[0-9\]+).*$gdb_prompt $" {
-	set inferior_pid $expect_out(1,string)
-	pass $test
-    }
-    -re "$gdb_prompt $" {
-	set inferior_pid unknown
-	pass $test
-    }
-}
-
-# Dump core using SIGABRT
-set oldtimeout $timeout
-set timeout 600
-gdb_test "signal SIGABRT" "Program terminated with signal SIGABRT, .*"
-
-# Find the corefile
-set file ""
-foreach pat [list core.${inferior_pid} ${testfile}.core core] {
-    set names [glob -nocomplain $pat]
-    if {[llength $names] == 1} {
-	set file [lindex $names 0]
-	remote_exec build "mv $file $corefile"
-	break
-    }
-}
-
-if { $file == "" } {
-    untested "Can't generate a core file"
-    return 0
-}
-
-# Check that the corefile is plausibly large enough.  We're trying to
-# detect the case where the operating system has truncated the file
-# just before signed wraparound.  TCL, unfortunately, has a similar
-# problem - so use catch.  It can handle the "bad" size but not
-# necessarily the "good" one.  And we must use GDB for the comparison,
-# similarly.
-
-if {[catch {file size $corefile} core_size] == 0} {
-    set core_ok 0
-    gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
-	-re " = 1\r\n$gdb_prompt $" {
-	    pass "check core size"
-	    set core_ok 1
-	}
-    }
-} { 
-    # Probably failed due to the TCL build having problems with very
-    # large values.  Since GDB uses a 64-bit off_t (when possible) it
-    # shouldn't have this problem.  Assume that things are going to
-    # work.  Without this assumption the test is skiped on systems
-    # (such as i386 GNU/Linux with patched kernel) which do pass.
-    pass "check core size"
-    set core_ok 1
-}
-if {! $core_ok} {
-    untested "check core size (system does not support large corefiles)"
-    return 0
-}
-
 # Now load up that core file
 
 set test "load corefile"
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index 25f7434..6873286 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -15,6 +15,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
 # written by Elena Zannoni (elz@apollo.hp.com)
 #
 # This file is part of the gdb testsuite
@@ -65,9 +68,6 @@
 
 get_debug_format
 
-# Many tests xfail with gcc 2 -gstabs+.
-# TODO: check out the hp side of this.
-
 proc local_compiler_xfail_check { } {
     if { [test_compiler_info gcc-2-*] } then {
 	if { ![test_debug_format "HP"] \
@@ -82,16 +82,6 @@
     }
 }
 
-# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
-
-proc local_compiler_xfail_check_2 { } {
-    if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
-	if { [test_debug_format "stabs" ] } {
-	    setup_xfail "*-*-*"
-	}
-    }
-}
-
 send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
 
     send_gdb "cont\n"
@@ -128,8 +118,10 @@
 # test function parameters
 
 local_compiler_xfail_check
-local_compiler_xfail_check_2
-
+if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+    # With stabs, even GCC 3 does not get the const char arguments correct.
+    setup_xfail "*-*-*"
+}
 send_gdb "ptype qux1\n"
 gdb_expect {
     -re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" {
@@ -281,7 +273,11 @@
     gdb_test "ptype locust" "type = double \\* const"
 
     local_compiler_xfail_check
-    local_compiler_xfail_check_2
+    if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+	# With stabs, even GCC 3 does not get the constant structure member
+	# correct.
+	setup_xfail "*-*-*"
+    }
     gdb_test "ptype crass" "type = struct crass \{\[\r\n\]+\[\ \t\]+char \\* const ptr;\[\r\n\]+\}"
     local_compiler_xfail_check
     gdb_test "ptype crisp" "type = struct crisp \{\[\r\n\]+\[\ \t\]+char \\* const \\*ptr;\[\r\n\]+\}"
diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp
index 671eab5..37bfbaa 100644
--- a/gdb/testsuite/gdb.base/overlays.exp
+++ b/gdb/testsuite/gdb.base/overlays.exp
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,11 +39,6 @@
     return 
 }
 
-if [istarget "*-*-linux*"] then {
-    verbose "Skipping overlay test -- Linux doesn't support overlayed programs."
-    return 
-}
-
 set testfile "overlays"
 set binfile ${objdir}/${subdir}/${testfile}
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 81f8eed..55de445 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -211,12 +211,12 @@
     set prefix "$i to handler"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     # Advance to the infinite loop
@@ -252,12 +252,12 @@
     set prefix "$i to handler entry"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     # Advance to the infinite loop
@@ -285,12 +285,12 @@
     set prefix "$i over handler"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     # Advance to the infinite loop
@@ -316,12 +316,12 @@
     set prefix "$i on breakpoint, to handler"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
@@ -361,12 +361,12 @@
     set prefix "$i on breakpoint, to handler entry"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
@@ -398,12 +398,12 @@
     set prefix "$i on breakpoint, skip handler"
     
     # Run around to the done
-    # You can add more patterns to this if you need them.
     set test "$prefix; resync"
     gdb_test_multiple "continue" "$test" {
 	-re "done = 0.*$gdb_prompt " {
 	    pass "$test"
 	}
+	# other patterns can go here
     }
     
     gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp
index b6623f8..c12e3d8 100644
--- a/gdb/testsuite/gdb.base/volatile.exp
+++ b/gdb/testsuite/gdb.base/volatile.exp
@@ -14,6 +14,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
 # Written by Satish Pai <pai@apollo.hp.com> 1997-07-07
 #    In the spirit of constvars.exp: added volatile, const-volatile stuff.
 
@@ -71,9 +74,6 @@
 
 get_debug_format
 
-# Many tests xfail with gcc 2 -gstabs+.
-# TODO: check out the hp side of this.
-
 proc local_compiler_xfail_check { } {
     if { [test_compiler_info gcc-2-*] } then {
 	if { ![test_debug_format "HP"] \
@@ -88,16 +88,6 @@
     }
 }
 
-# A few tests still xfail with gcc 3 -gstabs+ and gcc 4 -gstabs+.
-
-proc local_compiler_xfail_check_2 { } {
-    if { [test_compiler_info gcc-3-*] || [test_compiler_info gcc-4-*] } {
-	if { [test_debug_format "stabs" ] } {
-	    setup_xfail "*-*-*"
-	}
-    }
-}
-
 send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
 
     send_gdb "cont\n"
@@ -258,7 +248,11 @@
 
 # test function parameters
 local_compiler_xfail_check
-local_compiler_xfail_check_2
+if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then {
+    # For reasons unknown, GCC 3 with stabs mangles several cv-qualified
+    # arguments to this function.
+    setup_xfail "*-*-*"
+}
 send_gdb "ptype qux2\n"
 gdb_expect {
     -re "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.dwarf2/Makefile.in b/gdb/testsuite/gdb.dwarf2/Makefile.in
deleted file mode 100644
index c338e02..0000000
--- a/gdb/testsuite/gdb.dwarf2/Makefile.in
+++ /dev/null
@@ -1,38 +0,0 @@
-# Makefile for regression testing the GNU debugger.
-# Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2001, 2003, 2004
-# Free Software Foundation, Inc.
-
-# This file is part of GDB.
-
-# GDB is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# GDB is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-VPATH = @srcdir@
-srcdir = @srcdir@
-
-EXECUTABLES = *.x
-
-all info install-info dvi install uninstall installcheck check:
-	@echo "Nothing to be done for $@..."
-
-clean mostlyclean:
-	-rm -f *~ *.o a.out *.x *.ci *.tmp
-	-rm -f core core.coremaker coremaker.core corefile
-	-rm -f $(EXECUTABLES)
-
-distclean maintainer-clean realclean: clean
-	-rm -f *~ core
-	-rm -f Makefile config.status config.log
-	-rm -f *-init.exp
-	-rm -fr *.log summary detail *.plog *.sum *.psum site.*
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.S b/gdb/testsuite/gdb.dwarf2/dw2-basic.S
deleted file mode 100644
index 1e98a4d..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.S
+++ /dev/null
@@ -1,201 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
- 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
-
-/* Test a minimal file containing DWARF-2 information.  This test also
-   serves as a skeleton for other DWARF-2 tests.  Most other tests will
-   not be this extensively itemized and commented...  */
-
-/* Dummy function to provide debug information for.  */
-
-	.text
-.Lbegin_text1:
-	.globl func_cu1
-	.type func_cu1, %function
-func_cu1:
-.Lbegin_func_cu1:
-	.int 0
-.Lend_func_cu1:
-	.size func_cu1, .-func_cu1
-.Lend_text1:
-
-/* Debug information */
-
-	.section .debug_info
-.Lcu1_begin:
-	/* CU header */
-	.int	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
-.Lcu1_start:
-	.short	2				/* DWARF Version */
-	.int	.Labbrev1_begin			/* Offset into abbrev section */
-	.byte	4				/* Pointer size */
-
-	/* CU die */
-	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
-	.int	.Lline1_begin			/* DW_AT_stmt_list */
-	.int	.Lend_text1			/* DW_AT_high_pc */
-	.int	.Lbegin_text1			/* DW_AT_low_pc */
-	.ascii	"file1.txt\0"			/* DW_AT_name */
-	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
-	.byte	1				/* DW_AT_language (C) */
-
-	/* func_cu1 */
-	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
-	.byte		1			/* DW_AT_external */
-	.byte		1			/* DW_AT_decl_file */
-	.byte		2			/* DW_AT_decl_line */
-	.ascii		"func_cu1\0"		/* DW_AT_name */
-	.int		.Ltype_int-.Lcu1_begin	/* DW_AT_type */
-	.int		.Lbegin_func_cu1	/* DW_AT_low_pc */
-	.int		.Lend_func_cu1		/* DW_AT_high_pc */
-	.byte		1			/* DW_AT_frame_base: length */
-	.byte		0x55			/* DW_AT_frame_base: DW_OP_reg5 */
-
-.Ltype_int:
-	.uleb128	3			/* Abbrev: DW_TAG_base_type */
-	.ascii		"int\0"			/* DW_AT_name */
-	.byte		4			/* DW_AT_byte_size */
-	.byte		5			/* DW_AT_encoding */
-
-	.byte		0			/* End of children of CU */
-
-.Lcu1_end:
-
-/* Abbrev table */
-	.section .debug_abbrev
-.Labbrev1_begin:
-	.uleb128	1			/* Abbrev code */
-	.uleb128	0x11			/* DW_TAG_compile_unit */
-	.byte		1			/* has_children */
-	.uleb128	0x10			/* DW_AT_stmt_list */
-	.uleb128	0x6			/* DW_FORM_data4 */
-	.uleb128	0x12			/* DW_AT_high_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x11			/* DW_AT_low_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x25			/* DW_AT_producer */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x13			/* DW_AT_language */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.uleb128	2			/* Abbrev code */
-	.uleb128	0x2e			/* DW_TAG_subprogram */
-	.byte		0			/* has_children */
-	.uleb128	0x3f			/* DW_AT_external */
-	.uleb128	0xc			/* DW_FORM_flag */
-	.uleb128	0x3a			/* DW_AT_decl_file */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3b			/* DW_AT_decl_line */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x49			/* DW_AT_type */
-	.uleb128	0x13			/* DW_FORM_ref4 */
-	.uleb128	0x11			/* DW_AT_low_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x12			/* DW_AT_high_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x40			/* DW_AT_frame_base */
-	.uleb128	0xa			/* DW_FORM_block1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.uleb128	3			/* Abbrev code */
-	.uleb128	0x24			/* DW_TAG_base_type */
-	.byte		0			/* has_children */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0xb			/* DW_AT_byte_size */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3e			/* DW_AT_encoding */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-/* Line table */
-	.section .debug_line
-.Lline1_begin:
-	.int		.Lline1_end - .Lline1_start	/* Initial length */
-.Lline1_start:
-	.short		2			/* Version */
-	.int		.Lline1_lines - .Lline1_hdr	/* header_length */
-.Lline1_hdr:
-	.byte		1			/* Minimum insn length */
-	.byte		1			/* default_is_stmt */
-	.byte		1			/* line_base */
- 	.byte		1			/* line_range */
-	.byte		0x10			/* opcode_base */
-
-	/* Standard lengths */
-	.byte		0
-	.byte		1
-	.byte		1
-	.byte		1
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		0
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		0
-
-	/* Include directories */
-	.byte		0
-
-	/* File names */
-	.ascii		"file1.txt\0"
-	.uleb128	0
-	.uleb128	0
-	.uleb128	0
-
-	.byte		0
-
-.Lline1_lines:
-	.byte		0	/* DW_LNE_set_address */
-	.uleb128	5
-	.byte		2
-	.int		.Lbegin_func_cu1
-
-	.byte		3	/* DW_LNS_advance_line */
-	.sleb128	3	/* ... to 4 */
-
-	.byte		1	/* DW_LNS_copy */
-
-	.byte		1	/* DW_LNS_copy (second time as an end-of-prologue marker) */
-
-	.byte		0	/* DW_LNE_set_address */
-	.uleb128	5
-	.byte		2
-	.int		.Lend_func_cu1
-
-	.byte		0	/* DW_LNE_end_of_sequence */
-	.uleb128	1
-	.byte		1
-
-.Lline1_end:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
deleted file mode 100644
index 7e0611e..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
+++ /dev/null
@@ -1,53 +0,0 @@
-#   Copyright 2004
-#   Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Minimal DWARF-2 unit test
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-# For now pick a sampling of likely targets.
-if {![istarget *-*-linux*]
-    && ![istarget *-*-gnu*]
-    && ![istarget *-*-elf*]
-    && ![istarget arm-*-eabi*]
-    && ![istarget powerpc-*-eabi*]} {
-    return 0  
-}
-
-set testfile "dw2-basic"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
-
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "set listsize 1" ""
-gdb_test "list func_cu1" "4\tFile 1 Line 4"
-gdb_test "ptype func_cu1" "type = int \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
deleted file mode 100644
index b612f85..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
+++ /dev/null
@@ -1,236 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
- 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
-
-/* Test a minimal file containing DWARF-2 information.  This test also
-   serves as a skeleton for other DWARF-2 tests.  Most other tests will
-   not be this extensively itemized and commented...  */
-
-/* Dummy function to provide debug information for.  */
-
-	.text
-.Lbegin_text1:
-	.globl func_cu1
-	.type func_cu1, %function
-func_cu1:
-.Lbegin_func_cu1:
-	.int 0
-.Lend_func_cu1:
-	.size func_cu1, .-func_cu1
-.Lend_text1:
-
-/* Debug information */
-
-	.section .debug_info
-.Lcu1_begin:
-	/* CU header */
-	.int	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
-.Lcu1_start:
-	.short	2				/* DWARF Version */
-	.int	.Labbrev1_begin			/* Offset into abbrev section */
-	.byte	4				/* Pointer size */
-
-	/* CU die */
-	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
-	.int	.Lline1_begin			/* DW_AT_stmt_list */
-	.int	.Lend_text1			/* DW_AT_high_pc */
-	.int	.Lbegin_text1			/* DW_AT_low_pc */
-	.ascii	"file1.txt\0"			/* DW_AT_name */
-	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
-	.byte	1				/* DW_AT_language (C) */
-
-	/* func_cu1 */
-	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
-	.byte		1			/* DW_AT_external */
-	.byte		1			/* DW_AT_decl_file */
-	.byte		2			/* DW_AT_decl_line */
-	.ascii		"func_cu1\0"		/* DW_AT_name */
-	.int		.Ltype_int		/* DW_AT_type */
-	.int		.Lbegin_func_cu1	/* DW_AT_low_pc */
-	.int		.Lend_func_cu1		/* DW_AT_high_pc */
-	.byte		1			/* DW_AT_frame_base: length */
-	.byte		0x55			/* DW_AT_frame_base: DW_OP_reg5 */
-
-	.byte		0			/* End of children of CU */
-
-.Lcu1_end:
-
-	/* Second compilation unit.  */
-.Lcu2_begin:
-	/* CU header */
-	.int	.Lcu2_end - .Lcu2_start		/* Length of Compilation Unit */
-.Lcu2_start:
-	.short	2				/* DWARF Version */
-	.int	.Labbrev2_begin			/* Offset into abbrev section */
-	.byte	4				/* Pointer size */
-
-	/* CU die */
-	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
-	.ascii	"file1.txt\0"			/* DW_AT_name */
-	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
-	.byte	1				/* DW_AT_language (C) */
-
-.Ltype_int:
-	.uleb128	2			/* Abbrev: DW_TAG_base_type */
-	.ascii		"int\0"			/* DW_AT_name */
-	.byte		4			/* DW_AT_byte_size */
-	.byte		5			/* DW_AT_encoding */
-
-	.byte		0			/* End of children of CU */
-
-.Lcu2_end:
-
-/* Abbrev table */
-	.section .debug_abbrev
-.Labbrev1_begin:
-	.uleb128	1			/* Abbrev code */
-	.uleb128	0x11			/* DW_TAG_compile_unit */
-	.byte		1			/* has_children */
-	.uleb128	0x10			/* DW_AT_stmt_list */
-	.uleb128	0x6			/* DW_FORM_data4 */
-	.uleb128	0x12			/* DW_AT_high_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x11			/* DW_AT_low_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x25			/* DW_AT_producer */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x13			/* DW_AT_language */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.uleb128	2			/* Abbrev code */
-	.uleb128	0x2e			/* DW_TAG_subprogram */
-	.byte		0			/* has_children */
-	.uleb128	0x3f			/* DW_AT_external */
-	.uleb128	0xc			/* DW_FORM_flag */
-	.uleb128	0x3a			/* DW_AT_decl_file */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3b			/* DW_AT_decl_line */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x49			/* DW_AT_type */
-	.uleb128	0x10			/* DW_FORM_ref_addr */
-	.uleb128	0x11			/* DW_AT_low_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x12			/* DW_AT_high_pc */
-	.uleb128	0x1			/* DW_FORM_addr */
-	.uleb128	0x40			/* DW_AT_frame_base */
-	.uleb128	0xa			/* DW_FORM_block1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-.Labbrev2_begin:
-	.uleb128	1			/* Abbrev code */
-	.uleb128	0x11			/* DW_TAG_compile_unit */
-	.byte		1			/* has_children */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x25			/* DW_AT_producer */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0x13			/* DW_AT_language */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.uleb128	2			/* Abbrev code */
-	.uleb128	0x24			/* DW_TAG_base_type */
-	.byte		0			/* has_children */
-	.uleb128	0x3			/* DW_AT_name */
-	.uleb128	0x8			/* DW_FORM_string */
-	.uleb128	0xb			/* DW_AT_byte_size */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.uleb128	0x3e			/* DW_AT_encoding */
-	.uleb128	0xb			/* DW_FORM_data1 */
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-	.byte		0x0			/* Terminator */
-	.byte		0x0			/* Terminator */
-
-/* Line table */
-	.section .debug_line
-.Lline1_begin:
-	.int		.Lline1_end - .Lline1_start	/* Initial length */
-.Lline1_start:
-	.short		2			/* Version */
-	.int		.Lline1_lines - .Lline1_hdr	/* header_length */
-.Lline1_hdr:
-	.byte		1			/* Minimum insn length */
-	.byte		1			/* default_is_stmt */
-	.byte		1			/* line_base */
- 	.byte		1			/* line_range */
-	.byte		0x10			/* opcode_base */
-
-	/* Standard lengths */
-	.byte		0
-	.byte		1
-	.byte		1
-	.byte		1
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		0
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		1
-	.byte		0
-	.byte		0
-	.byte		0
-
-	/* Include directories */
-	.byte		0
-
-	/* File names */
-	.ascii		"file1.txt\0"
-	.uleb128	0
-	.uleb128	0
-	.uleb128	0
-
-	.byte		0
-
-.Lline1_lines:
-	.byte		0	/* DW_LNE_set_address */
-	.uleb128	5
-	.byte		2
-	.int		.Lbegin_func_cu1
-
-	.byte		3	/* DW_LNS_advance_line */
-	.sleb128	3	/* ... to 4 */
-
-	.byte		1	/* DW_LNS_copy */
-
-	.byte		1	/* DW_LNS_copy (second time as an end-of-prologue marker) */
-
-	.byte		0	/* DW_LNE_set_address */
-	.uleb128	5
-	.byte		2
-	.int		.Lend_func_cu1
-
-	.byte		0	/* DW_LNE_end_of_sequence */
-	.uleb128	1
-	.byte		1
-
-.Lline1_end:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
deleted file mode 100644
index d9a0cfd..0000000
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
+++ /dev/null
@@ -1,53 +0,0 @@
-#   Copyright 2004
-#   Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Minimal DWARF-2 unit test
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-# For now pick a sampling of likely targets.
-if {![istarget *-*-linux*]
-    && ![istarget *-*-gnu*]
-    && ![istarget *-*-elf*]
-    && ![istarget arm-*-eabi*]
-    && ![istarget powerpc-*-eabi*]} {
-    return 0  
-}
-
-set testfile "dw2-intercu"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
-
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "set listsize 1" ""
-gdb_test "list func_cu1" "4\tFile 1 Line 4"
-gdb_test "ptype func_cu1" "type = int \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/file1.txt b/gdb/testsuite/gdb.dwarf2/file1.txt
deleted file mode 100644
index b745e3a..0000000
--- a/gdb/testsuite/gdb.dwarf2/file1.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-File 1 Line 1
-File 1 Line 2
-File 1 Line 3
-File 1 Line 4
-File 1 Line 5
-File 1 Line 6
-File 1 Line 7
-File 1 Line 8
diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c
deleted file mode 100644
index 87442ac..0000000
--- a/gdb/testsuite/gdb.dwarf2/main.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
-   Copyright 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
- 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
-
-/* Dummy main function.  */
-
-int
-main()
-{
-  return 0;
-}
diff --git a/gdb/testsuite/gdb.mi/gdb701.c b/gdb/testsuite/gdb.mi/gdb701.c
index b1e72d2..16e5c29 100644
--- a/gdb/testsuite/gdb.mi/gdb701.c
+++ b/gdb/testsuite/gdb.mi/gdb701.c
@@ -11,5 +11,5 @@
 main (int argc, char *argv[])
 {
   Foo *foo = 0;
-  return 0;
+  exit (0);
 }
diff --git a/gdb/testsuite/gdb.threads/bp_in_thread.exp b/gdb/testsuite/gdb.threads/bp_in_thread.exp
index 91c3283..e9dfadb 100644
--- a/gdb/testsuite/gdb.threads/bp_in_thread.exp
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.exp
@@ -35,16 +35,15 @@
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-runto_main
 
 gdb_test "break noreturn" \
-         "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
+         "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
          "breakpoint on noreturn"
 
 # Run the program and make sure GDB reports that we stopped after
 # hitting breakpoint 1 in noreturn().
 
-gdb_test "continue" \
-         ".*Breakpoint 2, noreturn ().*" \
+gdb_test "run" \
+         ".*Breakpoint 1, noreturn ().*" \
          "run to noreturn"
 
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
index 91b695f..72ae03a 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
@@ -36,14 +36,13 @@
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-runto_main
 
 gdb_test "break break_me" \
-    "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
+    "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
          "breakpoint on break_me"
 
-gdb_test "continue" \
-         ".*Breakpoint 2, break_me ().*" \
+gdb_test "run" \
+         ".*Breakpoint 1, break_me ().*" \
          "run to break_me"
 
 # 
diff --git a/gdb/testsuite/gdb.threads/watchthreads.c b/gdb/testsuite/gdb.threads/watchthreads.c
deleted file mode 100644
index e19fe07..0000000
--- a/gdb/testsuite/gdb.threads/watchthreads.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
-   Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  
- 
-   This file is copied from schedlock.c.  */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-void *thread_function(void *arg); /* Pointer to function executed by each thread */
-
-#define NUM 5
-
-unsigned int args[NUM+1];
-
-int main() {
-    int res;
-    pthread_t threads[NUM];
-    void *thread_result;
-    long i;
-
-    for (i = 0; i < NUM; i++)
-      {
-	args[i] = 1; /* Init value.  */
-	res = pthread_create(&threads[i],
-		             NULL,
-			     thread_function,
-			     (void *) i);
-      }
-
-    args[i] = 1;
-    thread_function ((void *) i);
-
-    exit(EXIT_SUCCESS);
-}
-
-void *thread_function(void *arg) {
-    int my_number =  (long) arg;
-    int *myp = (int *) &args[my_number];
-
-    /* Don't run forever.  Run just short of it :)  */
-    while (*myp > 0)
-      {
-	(*myp) ++;  /* Loop increment.  */
-      }
-
-    pthread_exit(NULL);
-}
-
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index 0bb940f..d6e89d9 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -31,7 +31,7 @@
     return 0;
 }
 
-set testfile "watchthreads"
+set testfile "schedlock"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
@@ -60,20 +60,17 @@
 gdb_test "watch args\[0\]" "Hardware watchpoint 2: args\\\[0\\\]"
 gdb_test "watch args\[1\]" "Hardware watchpoint 3: args\\\[1\\\]"
 
-set init_line [expr [gdb_get_line_number "Init value"]+1]
-set inc_line [gdb_get_line_number "Loop increment"]
-
 # Loop and continue to allow both watchpoints to be triggered.
 for {set i 0} {$i < 30} {incr i} {
   set test_flag 0
   gdb_test_multiple "continue" "threaded watch loop" {
-    -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
+    -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
        { set args_0 1; set test_flag 1 }
-    -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads.c:$init_line.*$gdb_prompt $"
+    -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
        { set args_1 1; set test_flag 1 }
-    -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
+    -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*schedlock.c:42.*$gdb_prompt $"
        { set args_0 [expr $args_0+1]; set test_flag 1 }
-    -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*watchthreads.c:$inc_line.*$gdb_prompt $"
+    -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*schedlock.c:42.*$gdb_prompt $"
        { set args_1 [expr $args_1+1]; set test_flag 1 }
   }
   # If we fail above, don't bother continuing loop
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index 65d9fd5..8bf5292 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -987,8 +987,8 @@
     }
 
   xfer =
-    target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
-					    attrib, target);
+    target_beneath->to_xfer_memory (memaddr, myaddr, len, write, attrib,
+				    target);
 
   do_cleanups (old_chain);
   return xfer;
@@ -1339,7 +1339,7 @@
   thread_db_ops.to_wait = thread_db_wait;
   thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
   thread_db_ops.to_store_registers = thread_db_store_registers;
-  thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
+  thread_db_ops.to_xfer_memory = thread_db_xfer_memory;
   thread_db_ops.to_kill = thread_db_kill;
   thread_db_ops.to_create_inferior = thread_db_create_inferior;
   thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
diff --git a/gdb/top.c b/gdb/top.c
index 618dc86..e586efd 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -932,11 +932,15 @@
 	}
 
       if (c == '\n')
+#ifndef CRLF_SOURCE_FILES
+	break;
+#else
 	{
 	  if (input_index > 0 && result[input_index - 1] == '\r')
 	    input_index--;
 	  break;
 	}
+#endif
 
       result[input_index++] = c;
       while (input_index >= result_size)
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index c99f978..3dc62d5 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -94,14 +94,10 @@
         attrs = tui_border_attrs;
 
       wattron (win, attrs);
-#ifdef HAVE_WBORDER
       wborder (win, tui_border_vline, tui_border_vline,
                tui_border_hline, tui_border_hline,
                tui_border_ulcorner, tui_border_urcorner,
                tui_border_llcorner, tui_border_lrcorner);
-#else
-      box (win, tui_border_vline, tui_border_hline);
-#endif
       if (win_info->title)
         mvwaddstr (win, 0, 3, win_info->title);
       wattroff (win, attrs);
diff --git a/gdb/utils.c b/gdb/utils.c
index e30808c..1c7b738 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1168,6 +1168,21 @@
   return p;
 }
 
+char *
+msavestring (void *md, const char *ptr, size_t size)
+{
+  char *p = (char *) xmalloc (size + 1);
+  memcpy (p, ptr, size);
+  p[size] = 0;
+  return p;
+}
+
+char *
+mstrsave (void *md, const char *ptr)
+{
+  return (msavestring (md, ptr, strlen (ptr)));
+}
+
 void
 print_spaces (int n, struct ui_file *file)
 {
diff --git a/gdb/uw-thread.c b/gdb/uw-thread.c
index a7b6bc2..c37e0ff 100644
--- a/gdb/uw-thread.c
+++ b/gdb/uw-thread.c
@@ -332,9 +332,8 @@
 static int
 read_thr_debug (struct thread_debug *debugp)
 {
-  return base_ops.deprecated_xfer_memory (thr_debug_addr, (char *)debugp,
-					  sizeof (*debugp), 0, NULL,
-					  &base_ops);
+  return base_ops.to_xfer_memory (thr_debug_addr, (char *)debugp,
+				  sizeof (*debugp), 0, NULL, &base_ops);
 }
 
 /* Read into MAP the contents of the thread map at inferior process address
@@ -343,9 +342,8 @@
 static int
 read_map (CORE_ADDR mapp, struct thread_map *map)
 {
-  return base_ops.deprecated_xfer_memory ((CORE_ADDR)THR_MAP (mapp),
-					  (char *)map, sizeof (*map),
-					  0, NULL, &base_ops);
+  return base_ops.to_xfer_memory ((CORE_ADDR)THR_MAP (mapp), (char *)map,
+				  sizeof (*map), 0, NULL, &base_ops);
 }
 
 /* Read into LWP the contents of the lwp decriptor at inferior process address
@@ -354,8 +352,8 @@
 static int
 read_lwp (CORE_ADDR lwpp, __lwp_desc_t *lwp)
 {
-  return base_ops.deprecated_xfer_memory (lwpp, (char *)lwp,
-					  sizeof (*lwp), 0, NULL, &base_ops);
+  return base_ops.to_xfer_memory (lwpp, (char *)lwp,
+				  sizeof (*lwp), 0, NULL, &base_ops);
 }
 
 /* Iterate through all user threads, applying FUNC(<map>, <lwp>, DATA) until
@@ -377,9 +375,8 @@
 
   if (!read_thr_debug (&debug))
     return 0;
-  if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)debug.thr_map,
-					(char *)&mapp, sizeof (mapp), 0, NULL,
-					&base_ops))
+  if (!base_ops.to_xfer_memory ((CORE_ADDR)debug.thr_map, (char *)&mapp,
+				sizeof (mapp), 0, NULL, &base_ops))
     return 0;
   if (!mapp)
     return 0;
@@ -636,12 +633,11 @@
 
   /* Retrieve stub args. */
   sp = read_register_pid (SP_REGNUM, ptid);
-  if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0, (char *)&mapp,
-					sizeof (mapp), 0, NULL, &base_ops))
+  if (!base_ops.to_xfer_memory (sp + SP_ARG0, (char *)&mapp,
+				sizeof (mapp), 0, NULL, &base_ops))
     goto err;
-  if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0 + sizeof (mapp),
-					(char *)&change, sizeof (change), 0,
-					NULL, &base_ops))
+  if (!base_ops.to_xfer_memory (sp + SP_ARG0 + sizeof (mapp), (char *)&change,
+				sizeof (change), 0, NULL, &base_ops))
     goto err;
 
   /* create_inferior() may not have finished yet, so notice the main
@@ -957,7 +953,7 @@
   if (!(thr_debug_addr = SYMBOL_VALUE_ADDRESS (ms)))
     return;
 
-  /* Initialize base_ops.deprecated_xfer_memory().  */
+  /* Initialize base_ops.to_xfer_memory(). */
   base_ops = current_target;
 
   /* Load _thr_debug's current contents. */
@@ -988,8 +984,8 @@
 
       /* Activate the stub function. */
       onp = (CORE_ADDR)&((struct thread_debug *)thr_debug_addr)->thr_debug_on;
-      if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)onp, (char *)&one,
-					    sizeof (one), 1, NULL, &base_ops))
+      if (!base_ops.to_xfer_memory ((CORE_ADDR)onp, (char *)&one,
+				    sizeof (one), 1, NULL, &base_ops))
 	{
 	  delete_breakpoint (b);
 	  goto err;
diff --git a/gdb/v850ice.c b/gdb/v850ice.c
index 93746ff..21daeea 100644
--- a/gdb/v850ice.c
+++ b/gdb/v850ice.c
@@ -899,7 +899,7 @@
   v850ice_ops.to_fetch_registers = v850ice_fetch_registers;
   v850ice_ops.to_store_registers = v850ice_store_registers;
   v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store;
-  v850ice_ops.deprecated_xfer_memory = v850ice_xfer_memory;
+  v850ice_ops.to_xfer_memory = v850ice_xfer_memory;
   v850ice_ops.to_files_info = v850ice_files_info;
   v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint;
   v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint;
diff --git a/gdb/vaxbsd-nat.c b/gdb/vaxbsd-nat.c
index bd505be..b00e93d 100644
--- a/gdb/vaxbsd-nat.c
+++ b/gdb/vaxbsd-nat.c
@@ -22,14 +22,12 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
-#include "target.h"
 
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <machine/reg.h>
 
 #include "vax-tdep.h"
-#include "inf-ptrace.h"
 
 /* Supply the general-purpose registers stored in GREGS to REGCACHE.  */
 
@@ -64,8 +62,8 @@
 /* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
    for all registers.  */
 
-static void
-vaxbsd_fetch_inferior_registers (int regnum)
+void
+fetch_inferior_registers (int regnum)
 {
   struct reg regs;
 
@@ -79,8 +77,8 @@
 /* Store register REGNUM back into the inferior.  If REGNUM is -1, do
    this for all registers.  */
 
-static void
-vaxbsd_store_inferior_registers (int regnum)
+void
+store_inferior_registers (int regnum)
 {
   struct reg regs;
 
@@ -135,13 +133,6 @@
 void
 _initialize_vaxbsd_nat (void)
 {
-  struct target_ops *t;
-
-  t = inf_ptrace_target ();
-  t->to_fetch_registers = vaxbsd_fetch_inferior_registers;
-  t->to_store_registers = vaxbsd_store_inferior_registers;
-  add_target (t);
-
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (vaxbsd_supply_pcb);
 }
diff --git a/gdb/version.in b/gdb/version.in
index bf4a552..2623d0d 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-6.2.50_2004-10-18-cvs
+2004-09-21-cvs
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 9845d46..601f28b 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -86,6 +86,9 @@
 #define DEBUG_MEM(x)	if (debug_memory)	printf_unfiltered x
 #define DEBUG_EXCEPT(x)	if (debug_exceptions)	printf_unfiltered x
 
+/* Forward declaration */
+extern struct target_ops child_ops;
+
 static void child_stop (void);
 static int win32_child_thread_alive (ptid_t);
 void child_kill_inferior (void);
@@ -1439,7 +1442,7 @@
     dr[i] = 0;
   current_event.dwProcessId = pid;
   memset (&current_event, 0, sizeof (current_event));
-  push_target (&deprecated_child_ops);
+  push_target (&child_ops);
   child_init_thread_list ();
   disable_breakpoints_in_shlibs (1);
   child_clear_solibs ();
@@ -1651,7 +1654,7 @@
       gdb_flush (gdb_stdout);
     }
   inferior_ptid = null_ptid;
-  unpush_target (&deprecated_child_ops);
+  unpush_target (&child_ops);
 }
 
 char *
@@ -1901,7 +1904,7 @@
 {
   (void) child_continue (DBG_CONTINUE, -1);
   i386_cleanup_dregs();
-  unpush_target (&deprecated_child_ops);
+  unpush_target (&child_ops);
   generic_mourn_inferior ();
 }
 
@@ -2065,46 +2068,48 @@
 		PIDGET (inferior_ptid)));
 }
 
+struct target_ops child_ops;
+
 static void
 init_child_ops (void)
 {
-  deprecated_child_ops.to_shortname = "child";
-  deprecated_child_ops.to_longname = "Win32 child process";
-  deprecated_child_ops.to_doc = "Win32 child process (started by the \"run\" command).";
-  deprecated_child_ops.to_open = child_open;
-  deprecated_child_ops.to_close = child_close;
-  deprecated_child_ops.to_attach = child_attach;
-  deprecated_child_ops.to_detach = child_detach;
-  deprecated_child_ops.to_resume = child_resume;
-  deprecated_child_ops.to_wait = child_wait;
-  deprecated_child_ops.to_fetch_registers = child_fetch_inferior_registers;
-  deprecated_child_ops.to_store_registers = child_store_inferior_registers;
-  deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
-  deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
-  deprecated_child_ops.to_files_info = child_files_info;
-  deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
-  deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
-  deprecated_child_ops.to_terminal_init = terminal_init_inferior;
-  deprecated_child_ops.to_terminal_inferior = terminal_inferior;
-  deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
-  deprecated_child_ops.to_terminal_ours = terminal_ours;
-  deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
-  deprecated_child_ops.to_terminal_info = child_terminal_info;
-  deprecated_child_ops.to_kill = child_kill_inferior;
-  deprecated_child_ops.to_create_inferior = child_create_inferior;
-  deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
-  deprecated_child_ops.to_can_run = child_can_run;
-  deprecated_child_ops.to_thread_alive = win32_child_thread_alive;
-  deprecated_child_ops.to_pid_to_str = cygwin_pid_to_str;
-  deprecated_child_ops.to_stop = child_stop;
-  deprecated_child_ops.to_stratum = process_stratum;
-  deprecated_child_ops.to_has_all_memory = 1;
-  deprecated_child_ops.to_has_memory = 1;
-  deprecated_child_ops.to_has_stack = 1;
-  deprecated_child_ops.to_has_registers = 1;
-  deprecated_child_ops.to_has_execution = 1;
-  deprecated_child_ops.to_magic = OPS_MAGIC;
-  deprecated_child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
+  child_ops.to_shortname = "child";
+  child_ops.to_longname = "Win32 child process";
+  child_ops.to_doc = "Win32 child process (started by the \"run\" command).";
+  child_ops.to_open = child_open;
+  child_ops.to_close = child_close;
+  child_ops.to_attach = child_attach;
+  child_ops.to_detach = child_detach;
+  child_ops.to_resume = child_resume;
+  child_ops.to_wait = child_wait;
+  child_ops.to_fetch_registers = child_fetch_inferior_registers;
+  child_ops.to_store_registers = child_store_inferior_registers;
+  child_ops.to_prepare_to_store = child_prepare_to_store;
+  child_ops.to_xfer_memory = child_xfer_memory;
+  child_ops.to_files_info = child_files_info;
+  child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+  child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+  child_ops.to_terminal_init = terminal_init_inferior;
+  child_ops.to_terminal_inferior = terminal_inferior;
+  child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+  child_ops.to_terminal_ours = terminal_ours;
+  child_ops.to_terminal_save_ours = terminal_save_ours;
+  child_ops.to_terminal_info = child_terminal_info;
+  child_ops.to_kill = child_kill_inferior;
+  child_ops.to_create_inferior = child_create_inferior;
+  child_ops.to_mourn_inferior = child_mourn_inferior;
+  child_ops.to_can_run = child_can_run;
+  child_ops.to_thread_alive = win32_child_thread_alive;
+  child_ops.to_pid_to_str = cygwin_pid_to_str;
+  child_ops.to_stop = child_stop;
+  child_ops.to_stratum = process_stratum;
+  child_ops.to_has_all_memory = 1;
+  child_ops.to_has_memory = 1;
+  child_ops.to_has_stack = 1;
+  child_ops.to_has_registers = 1;
+  child_ops.to_has_execution = 1;
+  child_ops.to_magic = OPS_MAGIC;
+  child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
 }
 
 void
@@ -2180,7 +2185,7 @@
 	   "Display selectors infos.",
 	   &info_w32_cmdlist);
 
-  add_target (&deprecated_child_ops);
+  add_target (&child_ops);
 }
 
 /* Hardware watchpoint support, adapted from go32-nat.c code.  */
diff --git a/gdb/wince.c b/gdb/wince.c
index 0397bd4..a9dafee 100644
--- a/gdb/wince.c
+++ b/gdb/wince.c
@@ -1,6 +1,5 @@
 /* Target-vector operations for controlling Windows CE child processes, for GDB.
-
-   Copyright 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions, A Red Hat Company.
 
    This file is part of GDB.
@@ -127,6 +126,9 @@
 static char *remote_upload = NULL;	/* Set by set remoteupload */
 static int remote_add_host = 0;
 
+/* Forward declaration */
+extern struct target_ops child_ops;
+
 static int win32_child_thread_alive (ptid_t);
 void child_kill_inferior (void);
 
@@ -1763,7 +1765,7 @@
   memset (&current_event, 0, sizeof (current_event));
   current_event.dwThreadId = pi.dwThreadId;
   inferior_ptid = pid_to_ptid (current_event.dwThreadId);
-  push_target (&deprecated_child_ops);
+  push_target (&child_ops);
   child_init_thread_list ();
   child_add_thread (pi.dwThreadId, pi.hThread);
   init_wait_for_inferior ();
@@ -1784,7 +1786,7 @@
 child_mourn_inferior (void)
 {
   (void) child_continue (DBG_CONTINUE, -1);
-  unpush_target (&deprecated_child_ops);
+  unpush_target (&child_ops);
   stop_stub ();
   CeRapiUninit ();
   connection_initialized = 0;
@@ -1886,43 +1888,45 @@
   upload_to_device (file, file);
 }
 
+struct target_ops child_ops;
+
 static void
 init_child_ops (void)
 {
-  memset (&deprecated_child_ops, 0, sizeof (deprecated_child_ops));
-  deprecated_child_ops.to_shortname = (char *) "child";
-  deprecated_child_ops.to_longname = (char *) "Windows CE process";
-  deprecated_child_ops.to_doc = (char *) "Windows CE process (started by the \"run\" command).";
-  deprecated_child_ops.to_open = child_open;
-  deprecated_child_ops.to_close = child_close;
-  deprecated_child_ops.to_resume = child_resume;
-  deprecated_child_ops.to_wait = child_wait;
-  deprecated_child_ops.to_fetch_registers = child_fetch_inferior_registers;
-  deprecated_child_ops.to_store_registers = child_store_inferior_registers;
-  deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
-  deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
-  deprecated_child_ops.to_files_info = child_files_info;
-  deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
-  deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
-  deprecated_child_ops.to_terminal_init = terminal_init_inferior;
-  deprecated_child_ops.to_terminal_inferior = terminal_inferior;
-  deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
-  deprecated_child_ops.to_terminal_ours = terminal_ours;
-  deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
-  deprecated_child_ops.to_terminal_info = child_terminal_info;
-  deprecated_child_ops.to_kill = child_kill_inferior;
-  deprecated_child_ops.to_load = child_load;
-  deprecated_child_ops.to_create_inferior = child_create_inferior;
-  deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
-  deprecated_child_ops.to_can_run = child_can_run;
-  deprecated_child_ops.to_thread_alive = win32_child_thread_alive;
-  deprecated_child_ops.to_stratum = process_stratum;
-  deprecated_child_ops.to_has_all_memory = 1;
-  deprecated_child_ops.to_has_memory = 1;
-  deprecated_child_ops.to_has_stack = 1;
-  deprecated_child_ops.to_has_registers = 1;
-  deprecated_child_ops.to_has_execution = 1;
-  deprecated_child_ops.to_magic = OPS_MAGIC;
+  memset (&child_ops, 0, sizeof (child_ops));
+  child_ops.to_shortname = (char *) "child";
+  child_ops.to_longname = (char *) "Windows CE process";
+  child_ops.to_doc = (char *) "Windows CE process (started by the \"run\" command).";
+  child_ops.to_open = child_open;
+  child_ops.to_close = child_close;
+  child_ops.to_resume = child_resume;
+  child_ops.to_wait = child_wait;
+  child_ops.to_fetch_registers = child_fetch_inferior_registers;
+  child_ops.to_store_registers = child_store_inferior_registers;
+  child_ops.to_prepare_to_store = child_prepare_to_store;
+  child_ops.to_xfer_memory = child_xfer_memory;
+  child_ops.to_files_info = child_files_info;
+  child_ops.to_insert_breakpoint = memory_insert_breakpoint;
+  child_ops.to_remove_breakpoint = memory_remove_breakpoint;
+  child_ops.to_terminal_init = terminal_init_inferior;
+  child_ops.to_terminal_inferior = terminal_inferior;
+  child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+  child_ops.to_terminal_ours = terminal_ours;
+  child_ops.to_terminal_save_ours = terminal_save_ours;
+  child_ops.to_terminal_info = child_terminal_info;
+  child_ops.to_kill = child_kill_inferior;
+  child_ops.to_load = child_load;
+  child_ops.to_create_inferior = child_create_inferior;
+  child_ops.to_mourn_inferior = child_mourn_inferior;
+  child_ops.to_can_run = child_can_run;
+  child_ops.to_thread_alive = win32_child_thread_alive;
+  child_ops.to_stratum = process_stratum;
+  child_ops.to_has_all_memory = 1;
+  child_ops.to_has_memory = 1;
+  child_ops.to_has_stack = 1;
+  child_ops.to_has_registers = 1;
+  child_ops.to_has_execution = 1;
+  child_ops.to_magic = OPS_MAGIC;
 }
 
 
@@ -2019,7 +2023,7 @@
 		  &setlist),
      &showlist);
 
-  add_target (&deprecated_child_ops);
+  add_target (&child_ops);
 }
 
 /* Determine if the thread referenced by "pid" is alive
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 28f5d002..771a48e 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -20,25 +20,25 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "frame.h"
-#include "frame-base.h"
-#include "frame-unwind.h"
-#include "dwarf2-frame.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "gdbcmd.h"
-#include "gdbcore.h"
 #include "value.h"
-#include "dis-asm.h"
 #include "inferior.h"
-#include "gdb_string.h"
-#include "gdb_assert.h"
 #include "arch-utils.h"
-#include "floatformat.h"
 #include "regcache.h"
-#include "doublest.h"
-#include "osabi.h"
+#include "gdbcore.h"
 #include "objfiles.h"
+#include "dis-asm.h"
+
+struct gdbarch_tdep
+{
+  /* gdbarch target dependent data here. Currently unused for Xstormy16. */
+};
+
+/* Extra info which is saved in each frame_info. */
+struct frame_extra_info
+{
+  int framesize;
+  int frameless_p;
+};
 
 enum gdb_regnum
 {
@@ -69,20 +69,6 @@
   E_NUM_REGS
 };
 
-/* Use an invalid address value as 'not available' marker.  */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
-
-struct xstormy16_frame_cache
-{
-  /* Base address.  */
-  CORE_ADDR base;
-  CORE_ADDR pc;
-  LONGEST framesize;
-  int uses_fp;
-  CORE_ADDR saved_regs[E_NUM_REGS];
-  CORE_ADDR saved_sp;
-};
-
 /* Size of instructions, registers, etc. */
 enum
 {
@@ -101,8 +87,15 @@
   E_MAX_RETTYPE_SIZE_IN_REGS = E_MAX_RETTYPE_SIZE (E_R2_REGNUM)
 };
 
+
+/* Size of all registers as a whole. */
+enum
+{
+  E_ALL_REGS_SIZE = (E_NUM_REGS - 1) * xstormy16_reg_size + xstormy16_pc_size
+};
+
 /* Function: xstormy16_register_name
-   Returns the name of the standard Xstormy16 register N.  */
+   Returns the name of the standard Xstormy16 register N. */
 
 static const char *
 xstormy16_register_name (int regnum)
@@ -113,7 +106,8 @@
     "psw", "sp", "pc"
   };
 
-  if (regnum < 0 || regnum >= E_NUM_REGS)
+  if (regnum < 0 ||
+      regnum >= sizeof (register_names) / sizeof (register_names[0]))
     internal_error (__FILE__, __LINE__,
 		    "xstormy16_register_name: illegal register number %d",
 		    regnum);
@@ -122,18 +116,172 @@
 
 }
 
-static struct type *
-xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
+/* Function: xstormy16_register_byte 
+   Returns the byte position in the register cache for register N. */
+
+static int
+xstormy16_register_byte (int regnum)
 {
-  if (regnum == E_PC_REGNUM)
+  if (regnum < 0 || regnum >= E_NUM_REGS)
+    internal_error (__FILE__, __LINE__,
+		    "xstormy16_register_byte: illegal register number %d",
+		    regnum);
+  else
+    /* All registers occupy 2 bytes in the regcache except for PC
+       which is the last one. Therefore the byte position is still
+       simply a multiple of 2. */
+    return regnum * xstormy16_reg_size;
+}
+
+/* Function: xstormy16_register_raw_size
+   Returns the number of bytes occupied by the register on the target. */
+
+static int
+xstormy16_register_raw_size (int regnum)
+{
+  if (regnum < 0 || regnum >= E_NUM_REGS)
+    internal_error (__FILE__, __LINE__,
+		    "xstormy16_register_raw_size: illegal register number %d",
+		    regnum);
+  /* Only the PC has 4 Byte, all other registers 2 Byte. */
+  else if (regnum == E_PC_REGNUM)
+    return xstormy16_pc_size;
+  else
+    return xstormy16_reg_size;
+}
+
+/* Function: xstormy16_reg_virtual_type 
+   Returns the default type for register N. */
+
+static struct type *
+xstormy16_reg_virtual_type (int regnum)
+{
+  if (regnum < 0 || regnum >= E_NUM_REGS)
+    internal_error (__FILE__, __LINE__,
+		    "xstormy16_register_virtual_type: illegal register number %d",
+		    regnum);
+  else if (regnum == E_PC_REGNUM)
     return builtin_type_uint32;
   else
     return builtin_type_uint16;
 }
 
+/* Function: xstormy16_get_saved_register
+   Find a register's saved value on the call stack.
+
+   Find register number REGNUM relative to FRAME and put its (raw,
+   target format) contents in *RAW_BUFFER.
+
+   Set *OPTIMIZED if the variable was optimized out (and thus can't be
+   fetched).  Note that this is never set to anything other than zero
+   in this implementation.
+
+   Set *LVAL to lval_memory, lval_register, or not_lval, depending on
+   whether the value was fetched from memory, from a register, or in a
+   strange and non-modifiable way (e.g. a frame pointer which was
+   calculated rather than fetched).  We will use not_lval for values
+   fetched from generic dummy frames.
+
+   Set *ADDRP to the address, either in memory or as a
+   DEPRECATED_REGISTER_BYTE offset into the registers array.  If the
+   value is stored in a dummy frame, set *ADDRP to zero.
+
+   The argument RAW_BUFFER must point to aligned memory.
+
+   The GET_SAVED_REGISTER architecture interface is entirely
+   redundant.  New architectures should implement per-frame unwinders
+   (ref "frame-unwind.h").  */
+
+static void
+xstormy16_get_saved_register (char *raw_buffer, int *optimized,
+			      CORE_ADDR *addrp,
+			      struct frame_info *frame, int regnum,
+			      enum lval_type *lval)
+{
+  if (!target_has_registers)
+    error ("No registers.");
+
+  /* Normal systems don't optimize out things with register numbers.  */
+  if (optimized != NULL)
+    *optimized = 0;
+
+  if (addrp)			/* default assumption: not found in memory */
+    *addrp = 0;
+
+  /* Note: since the current frame's registers could only have been
+     saved by frames INTERIOR TO the current frame, we skip examining
+     the current frame itself: otherwise, we would be getting the
+     previous frame's registers which were saved by the current frame.  */
+
+  if (frame != NULL)
+    {
+      for (frame = get_next_frame (frame);
+	   get_frame_type (frame) != SENTINEL_FRAME;
+	   frame = get_next_frame (frame))
+	{
+	  if (get_frame_type (frame) == DUMMY_FRAME)
+	    {
+	      if (lval)		/* found it in a CALL_DUMMY frame */
+		*lval = not_lval;
+	      if (raw_buffer)
+		{
+		  LONGEST val;
+		  /* FIXME: cagney/2002-06-26: This should be via the
+		     gdbarch_register_read() method so that it, on the
+		     fly, constructs either a raw or pseudo register
+		     from the raw register cache.  */
+		  val = deprecated_read_register_dummy (get_frame_pc (frame),
+							get_frame_base (frame),
+							regnum);
+		  store_unsigned_integer (raw_buffer,
+					  register_size (current_gdbarch, regnum),
+					  val);
+		}
+	      return;
+	    }
+
+	  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+	  if (deprecated_get_frame_saved_regs (frame) != NULL
+	      && deprecated_get_frame_saved_regs (frame)[regnum] != 0)
+	    {
+	      if (lval)		/* found it saved on the stack */
+		*lval = lval_memory;
+	      if (regnum == SP_REGNUM)
+		{
+		  if (raw_buffer)	/* SP register treated specially */
+		    /* NOTE: cagney/2003-05-09: In-line store_address()
+                       with it's body - store_unsigned_integer().  */
+		    store_unsigned_integer (raw_buffer,
+					    register_size (current_gdbarch, regnum),
+					    deprecated_get_frame_saved_regs (frame)[regnum]);
+		}
+	      else
+		{
+		  if (addrp)	/* any other register */
+		    *addrp = deprecated_get_frame_saved_regs (frame)[regnum];
+		  if (raw_buffer)
+		    read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer,
+				 register_size (current_gdbarch, regnum));
+		}
+	      return;
+	    }
+	}
+    }
+
+  /* If we get thru the loop to this point, it means the register was
+     not saved in any frame.  Return the actual live-register value.  */
+
+  if (lval)			/* found it in a live register */
+    *lval = lval_register;
+  if (addrp)
+    *addrp = DEPRECATED_REGISTER_BYTE (regnum);
+  if (raw_buffer)
+    deprecated_read_register_gen (regnum, raw_buffer);
+}
+
 /* Function: xstormy16_type_is_scalar
    Makes the decision if a given type is a scalar types.  Scalar
-   types are returned in the registers r2-r7 as they fit.  */
+   types are returned in the registers r2-r7 as they fit. */
 
 static int
 xstormy16_type_is_scalar (struct type *t)
@@ -143,117 +291,66 @@
 	  && TYPE_CODE(t) != TYPE_CODE_ARRAY);
 }
 
-/* Function: xstormy16_use_struct_convention 
-   Returns non-zero if the given struct type will be returned using
-   a special convention, rather than the normal function return method.
-   7sed in the contexts of the "return" command, and of
-   target function calls from the debugger.  */ 
-
-static int
-xstormy16_use_struct_convention (struct type *type)
-{
-  return !xstormy16_type_is_scalar (type)
-	 || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
-} 
-
 /* Function: xstormy16_extract_return_value
-   Find a function's return value in the appropriate registers (in
-   regbuf), and copy it into valbuf.  */
+   Copy the function's return value into VALBUF. 
+   This function is called only in the context of "target function calls",
+   ie. when the debugger forces a function to be called in the child, and
+   when the debugger forces a function to return prematurely via the
+   "return" command. */
 
 static void
-xstormy16_extract_return_value (struct type *type, struct regcache *regcache,
-				void *valbuf)
+xstormy16_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
-  int len = TYPE_LENGTH (type);
-  int i, regnum = E_1ST_ARG_REGNUM;
+  CORE_ADDR return_buffer;
+  int offset = 0;
 
-  for (i = 0; i < len; i += xstormy16_reg_size)
-    regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
-}
-
-/* Function: xstormy16_store_return_value
-   Copy the function return value from VALBUF into the
-   proper location for a function return. 
-   Called only in the context of the "return" command.  */
-
-static void 
-xstormy16_store_return_value (struct type *type, struct regcache *regcache,
-			      const void *valbuf)
-{
-  if (TYPE_LENGTH (type) == 1)
-    {    
-      /* Add leading zeros to the value. */
-      char buf[xstormy16_reg_size];
-      memset (buf, 0, xstormy16_reg_size);
-      memcpy (buf, valbuf, 1);
-      regcache_raw_write (regcache, E_1ST_ARG_REGNUM, buf);
+  if (xstormy16_type_is_scalar (type)
+      && TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
+    {
+      /* Scalar return values of <= 12 bytes are returned in 
+         E_1ST_ARG_REGNUM to E_LST_ARG_REGNUM. */
+      memcpy (valbuf,
+	      &regbuf[DEPRECATED_REGISTER_BYTE (E_1ST_ARG_REGNUM)] + offset,
+	      TYPE_LENGTH (type));
     }
   else
     {
-      int len = TYPE_LENGTH (type);
-      int i, regnum = E_1ST_ARG_REGNUM;
+      /* Aggregates and return values > 12 bytes are returned in memory,
+         pointed to by R2. */
+      return_buffer =
+	extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (E_PTR_RET_REGNUM),
+				  register_size (current_gdbarch, E_PTR_RET_REGNUM));
 
-      for (i = 0; i < len; i += xstormy16_reg_size)
-        regcache_raw_write (regcache, regnum++, (char *) valbuf + i);
+      read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
     }
 }
 
-static enum return_value_convention
-xstormy16_return_value (struct gdbarch *gdbarch, struct type *type,
-			struct regcache *regcache,
-			void *readbuf, const void *writebuf)
-{
-  if (xstormy16_use_struct_convention (type))
-    return RETURN_VALUE_STRUCT_CONVENTION;
-  if (writebuf)
-    xstormy16_store_return_value (type, regcache, writebuf);
-  else if (readbuf)
-    xstormy16_extract_return_value (type, regcache, readbuf);
-  return RETURN_VALUE_REGISTER_CONVENTION;
-}
-
-static CORE_ADDR
-xstormy16_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
-{
-  if (addr & 1)
-    ++addr;
-  return addr;
-}
-
-/* Function: xstormy16_push_dummy_call
+/* Function: xstormy16_push_arguments
    Setup the function arguments for GDB to call a function in the inferior.
    Called only in the context of a target function call from the debugger.
-   Returns the value of the SP register after the args are pushed.  */
+   Returns the value of the SP register after the args are pushed.
+*/
 
 static CORE_ADDR
-xstormy16_push_dummy_call (struct gdbarch *gdbarch,
-			   struct value *function,
-			   struct regcache *regcache,
-			   CORE_ADDR bp_addr, int nargs,
-			   struct value **args,
-			   CORE_ADDR sp, int struct_return,
-			   CORE_ADDR struct_addr)
+xstormy16_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+			  int struct_return, CORE_ADDR struct_addr)
 {
   CORE_ADDR stack_dest = sp;
   int argreg = E_1ST_ARG_REGNUM;
   int i, j;
   int typelen, slacklen;
   char *val;
-  char buf[xstormy16_pc_size];
 
   /* If struct_return is true, then the struct return address will
      consume one argument-passing register.  */
   if (struct_return)
-    {
-      regcache_cooked_write_unsigned (regcache, E_PTR_RET_REGNUM, struct_addr);
-      argreg++;
-    }
+    argreg++;
 
   /* Arguments are passed in R2-R7 as they fit. If an argument doesn't
      fit in the remaining registers we're switching over to the stack.
      No argument is put on stack partially and as soon as we switched
      over to stack no further argument is put in a register even if it
-     would fit in the remaining unused registers.  */
+     would fit in the remaining unused registers. */
   for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
     {
       typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
@@ -263,7 +360,7 @@
       /* Put argument into registers wordwise. */
       val = VALUE_CONTENTS (args[i]);
       for (j = 0; j < typelen; j += xstormy16_reg_size)
-	regcache_cooked_write_unsigned (regcache, argreg++,
+	write_register (argreg++,
 			extract_unsigned_integer (val + j,
 						  typelen - j ==
 						  1 ? 1 :
@@ -271,10 +368,11 @@
     }
 
   /* Align SP */
-  stack_dest = xstormy16_frame_align (gdbarch, stack_dest);
+  if (stack_dest & 1)
+    ++stack_dest;
 
   /* Loop backwards through remaining arguments and push them on the stack,
-     wordaligned.  */
+     wordaligned. */
   for (j = nargs - 1; j >= i; j--)
     {
       typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[j]));
@@ -288,16 +386,154 @@
       stack_dest += typelen + slacklen;
     }
 
-  store_unsigned_integer (buf, xstormy16_pc_size, bp_addr);
-  write_memory (stack_dest, buf, xstormy16_pc_size);
-  stack_dest += xstormy16_pc_size;
+  /* And that should do it.  Return the new stack pointer. */
+  return stack_dest;
+}
 
-  /* Update stack pointer.  */
-  regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, stack_dest);
+/* Function: xstormy16_push_return_address (pc)
+   Setup the return address for GDB to call a function in the inferior.
+   Called only in the context of a target function call from the debugger.
+   Returns the value of the SP register when the operation is finished
+   (which may or may not be the same as before).
+*/
 
-  /* Return the new stack pointer minus the return address slot since
-     that's what DWARF2/GCC uses as the frame's CFA.  */
-  return stack_dest - xstormy16_pc_size;
+static CORE_ADDR
+xstormy16_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
+{
+  unsigned char buf[xstormy16_pc_size];
+
+  store_unsigned_integer (buf, xstormy16_pc_size, entry_point_address ());
+  write_memory (sp, buf, xstormy16_pc_size);
+  return sp + xstormy16_pc_size;
+}
+
+/* Function: xstormy16_pop_frame
+   Destroy the innermost (Top-Of-Stack) stack frame, restoring the 
+   machine state that was in effect before the frame was created. 
+   Used in the contexts of the "return" command, and of 
+   target function calls from the debugger.
+*/
+
+static void
+xstormy16_pop_frame (void)
+{
+  struct frame_info *fi = get_current_frame ();
+  int i;
+
+  if (fi == NULL)
+    return;			/* paranoia */
+
+  if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+    {
+      deprecated_pop_dummy_frame ();
+    }
+  else
+    {
+      /* Restore the saved regs. */
+      for (i = 0; i < NUM_REGS; i++)
+	if (deprecated_get_frame_saved_regs (fi)[i])
+	  {
+	    if (i == SP_REGNUM)
+	      write_register (i, deprecated_get_frame_saved_regs (fi)[i]);
+	    else if (i == E_PC_REGNUM)
+	      write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
+						      xstormy16_pc_size));
+	    else
+	      write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
+						      xstormy16_reg_size));
+	  }
+      /* Restore the PC */
+      write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
+      flush_cached_frames ();
+    }
+  return;
+}
+
+/* Function: xstormy16_store_struct_return
+   Copy the (struct) function return value to its destined location. 
+   Called only in the context of a target function call from the debugger.
+*/
+
+static void
+xstormy16_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+  write_register (E_PTR_RET_REGNUM, addr);
+}
+
+/* Function: xstormy16_store_return_value
+   Copy the function return value from VALBUF into the 
+   proper location for a function return. 
+   Called only in the context of the "return" command.
+*/
+
+static void
+xstormy16_store_return_value (struct type *type, char *valbuf)
+{
+  CORE_ADDR return_buffer;
+  char buf[xstormy16_reg_size];
+
+  if (xstormy16_type_is_scalar (type) && TYPE_LENGTH (type) == 1)
+    {
+      /* Add leading zeros to the value. */
+      memset (buf, 0, xstormy16_reg_size);
+      memcpy (buf, valbuf, 1);
+      deprecated_write_register_gen (E_1ST_ARG_REGNUM, buf);
+    }
+  else if (xstormy16_type_is_scalar (type) &&
+	   TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
+    deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (E_1ST_ARG_REGNUM),
+				     valbuf, TYPE_LENGTH (type));
+  else
+    {
+      return_buffer = read_register (E_PTR_RET_REGNUM);
+      write_memory (return_buffer, valbuf, TYPE_LENGTH (type));
+    }
+}
+
+/* Function: xstormy16_extract_struct_value_address
+   Returns the address in which a function should return a struct value. 
+   Used in the contexts of the "return" command, and of 
+   target function calls from the debugger.
+*/
+
+static CORE_ADDR
+xstormy16_extract_struct_value_address (struct regcache *regcache)
+{
+  /* FIXME: cagney/2004-01-17: Does the ABI guarantee that the return
+     address regster is preserved across function calls?  Probably
+     not, making this function wrong.  */
+  ULONGEST val;
+  regcache_raw_read_unsigned (regcache, E_PTR_RET_REGNUM, &val);
+  return val;
+}
+
+/* Function: xstormy16_use_struct_convention 
+   Returns non-zero if the given struct type will be returned using
+   a special convention, rather than the normal function return method. 
+   7sed in the contexts of the "return" command, and of 
+   target function calls from the debugger.
+*/
+
+static int
+xstormy16_use_struct_convention (int gcc_p, struct type *type)
+{
+  return !xstormy16_type_is_scalar (type)
+    || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
+}
+
+/* Function: frame_saved_register
+   Returns the value that regnum had in frame fi
+   (saved in fi or in one of its children).  
+*/
+
+static CORE_ADDR
+xstormy16_frame_saved_register (struct frame_info *fi, int regnum)
+{
+  int size = xstormy16_register_raw_size (regnum);
+  char *buf = (char *) alloca (size);
+
+  xstormy16_get_saved_register (buf, NULL, NULL, fi, regnum, NULL);
+  return (CORE_ADDR) extract_unsigned_integer (buf, size);
 }
 
 /* Function: xstormy16_scan_prologue
@@ -305,25 +541,36 @@
    Decide when we must have reached the end of the function prologue.
    If a frame_info pointer is provided, fill in its saved_regs etc.
 
-   Returns the address of the first instruction after the prologue.  */
+   Returns the address of the first instruction after the prologue. 
+*/
 
 static CORE_ADDR
-xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
-			    struct xstormy16_frame_cache *cache,
-			    struct frame_info *next_frame)
+xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
+			 struct frame_info *fi, int *frameless)
 {
+  CORE_ADDR sp = 0, fp = 0;
   CORE_ADDR next_addr;
   ULONGEST inst, inst2;
   LONGEST offset;
   int regnum;
 
-  /* Initialize framesize with size of PC put on stack by CALLF inst. */
-  cache->saved_regs[E_PC_REGNUM] = 0;
-  cache->framesize = xstormy16_pc_size;
+  if (frameless)
+    *frameless = 1;
+  if (fi)
+    {
+      /* In a call dummy, don't touch the frame. */
+      if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+	return start_addr;
 
-  if (start_addr >= end_addr)
-    return end_addr;
+      /* Grab the frame-relative values of SP and FP, needed below. 
+         The frame_saved_register function will find them on the
+         stack or in the registers as appropriate. */
+      sp = xstormy16_frame_saved_register (fi, E_SP_REGNUM);
+      fp = xstormy16_frame_saved_register (fi, E_FP_REGNUM);
 
+      /* Initialize framesize with size of PC put on stack by CALLF inst. */
+      get_frame_extra_info (fi)->framesize = xstormy16_pc_size;
+    }
   for (next_addr = start_addr;
        next_addr < end_addr; next_addr += xstormy16_inst_size)
     {
@@ -333,33 +580,42 @@
 
       if (inst >= 0x0082 && inst <= 0x008d)	/* push r2 .. push r13 */
 	{
-	  regnum = inst & 0x000f;
-	  cache->saved_regs[regnum] = cache->framesize;
-	  cache->framesize += xstormy16_reg_size;
+	  if (fi)
+	    {
+	      regnum = inst & 0x000f;
+	      deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize;
+	      get_frame_extra_info (fi)->framesize += xstormy16_reg_size;
+	    }
 	}
 
       /* optional stack allocation for args and local vars <= 4 byte */
       else if (inst == 0x301f || inst == 0x303f)	/* inc r15, #0x1/#0x3 */
 	{
-	  cache->framesize += ((inst & 0x0030) >> 4) + 1;
+	  if (fi)		/* Record the frame size. */
+	    get_frame_extra_info (fi)->framesize += ((inst & 0x0030) >> 4) + 1;
 	}
 
       /* optional stack allocation for args and local vars > 4 && < 16 byte */
       else if ((inst & 0xff0f) == 0x510f)	/* 51Hf   add r15, #0xH */
 	{
-	  cache->framesize += (inst & 0x00f0) >> 4;
+	  if (fi)		/* Record the frame size. */
+	    get_frame_extra_info (fi)->framesize += (inst & 0x00f0) >> 4;
 	}
 
       /* optional stack allocation for args and local vars >= 16 byte */
       else if (inst == 0x314f && inst2 >= 0x0010)	/* 314f HHHH  add r15, #0xH */
 	{
-	  cache->framesize += inst2;
+	  if (fi)		/* Record the frame size. */
+	    get_frame_extra_info (fi)->framesize += inst2;
 	  next_addr += xstormy16_inst_size;
 	}
 
       else if (inst == 0x46fd)	/* mov r13, r15 */
 	{
-	  cache->uses_fp = 1;
+	  if (fi)		/* Record that the frame pointer is in use. */
+	    get_frame_extra_info (fi)->frameless_p = 0;
+	  if (frameless)
+	    *frameless = 0;
 	}
 
       /* optional copying of args in r2-r7 to r10-r13 */
@@ -374,21 +630,83 @@
       /* 73DS HHHH   mov.w (rD, 0xHHHH), r(S-8) */
       else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2)
 	{
-	  regnum = inst & 0x0007;
-	  /* Only 12 of 16 bits of the argument are used for the
-	     signed offset. */
-	  offset = (LONGEST) (inst2 & 0x0fff);
-	  if (offset & 0x0800)
-	    offset -= 0x1000;
+	  if (fi)
+	    {
+	      regnum = inst & 0x0007;
+	      /* Only 12 of 16 bits of the argument are used for the
+	         signed offset. */
+	      offset = (LONGEST) (inst2 & 0x0fff);
+	      if (offset & 0x0800)
+		offset -= 0x1000;
 
-	  cache->saved_regs[regnum] = cache->framesize + offset;
+	      deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize + offset;
+	    }
 	  next_addr += xstormy16_inst_size;
 	}
 
+#if 0
+      /* 2001-08-10: Not part of the prologue anymore due to change in
+         ABI. r8 and r9 are not used for argument passing anymore. */
+
+      /* optional copying of r8, r9 to stack */
+      /* 46S7; 73Df HHHH   mov.w r7,rS; mov.w (rD, 0xHHHH), r7 D=8,9; S=13,15 */
+      /* 46S7; 72df HHHH   mov.w r7,rS; mov.b (rD, 0xHHHH), r7 D=8,9; S=13,15 */
+      else if ((inst & 0xffef) == 0x4687 && (inst2 & 0xfedf) == 0x72df)
+	{
+	  next_addr += xstormy16_inst_size;
+	  if (fi)
+	    {
+	      regnum = (inst & 0x00f0) >> 4;
+	      inst = inst2;
+	      inst2 = read_memory_unsigned_integer (next_addr
+						    + xstormy16_inst_size,
+						    xstormy16_inst_size);
+	      /* Only 12 of 16 bits of the argument are used for the
+	         signed offset. */
+	      offset = (LONGEST) (inst2 & 0x0fff);
+	      if (offset & 0x0800)
+		offset -= 0x1000;
+
+	      fi->saved_regs[regnum] = fi->extra_info->framesize + offset;
+	    }
+	  next_addr += xstormy16_inst_size;
+	}
+#endif
+
       else			/* Not a prologue instruction. */
 	break;
     }
 
+  if (fi)
+    {
+      /* Special handling for the "saved" address of the SP:
+         The SP is of course never saved on the stack at all, so
+         by convention what we put here is simply the previous 
+         _value_ of the SP (as opposed to an address where the
+         previous value would have been pushed).  */
+      if (get_frame_extra_info (fi)->frameless_p)
+	{
+	  deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - get_frame_extra_info (fi)->framesize;
+	  deprecated_update_frame_base_hack (fi, sp);
+	}
+      else
+	{
+	  deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - get_frame_extra_info (fi)->framesize;
+	  deprecated_update_frame_base_hack (fi, fp);
+	}
+
+      /* So far only offsets to the beginning of the frame are
+         saved in the saved_regs. Now we now the relation between
+         sp, fp and framesize. We know the beginning of the frame
+         so we can translate the register offsets to real addresses. */
+      for (regnum = 0; regnum < E_SP_REGNUM; ++regnum)
+	if (deprecated_get_frame_saved_regs (fi)[regnum])
+	  deprecated_get_frame_saved_regs (fi)[regnum] += deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM];
+
+      /* Save address of PC on stack. */
+      deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM] = deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM];
+    }
+
   return next_addr;
 }
 
@@ -412,12 +730,12 @@
     {
       struct symtab_and_line sal;
       struct symbol *sym;
-      struct xstormy16_frame_cache cache;
 
       /* Don't trust line number debug info in frameless functions. */
-      CORE_ADDR plg_end = xstormy16_analyze_prologue (func_addr, func_end,
-						      &cache, NULL);
-      if (!cache.uses_fp)
+      int frameless = 1;
+      CORE_ADDR plg_end = xstormy16_scan_prologue (func_addr, func_end,
+						   NULL, &frameless);
+      if (frameless)
         return plg_end;
 
       /* Found a function.  */
@@ -447,7 +765,7 @@
 static int
 xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  CORE_ADDR func_addr = 0, func_end = 0;
+  CORE_ADDR addr, func_addr = 0, func_end = 0;
 
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
@@ -486,6 +804,151 @@
   return 0;
 }
 
+/* Function: xstormy16_frame_init_saved_regs
+   Set up the 'saved_regs' array.
+   This is a data structure containing the addresses on the stack 
+   where each register has been saved, for each stack frame.  
+   Registers that have not been saved will have zero here.
+   The stack register is special: rather than the address where the 
+   stack register has been saved, saved_regs[SP_REGNUM] will have the
+   actual value of the previous frame's stack register. 
+
+   This function may be called in any context where the saved register
+   values may be needed (backtrace, frame_info, frame_register).  On
+   many targets, it is called directly by init_extra_frame_info, in
+   part because the information may be needed immediately by
+   frame_chain.  */
+
+static void
+xstormy16_frame_init_saved_regs (struct frame_info *fi)
+{
+  CORE_ADDR func_addr, func_end;
+
+  if (!deprecated_get_frame_saved_regs (fi))
+    {
+      frame_saved_regs_zalloc (fi);
+
+      /* Find the beginning of this function, so we can analyze its
+         prologue. */
+      if (find_pc_partial_function (get_frame_pc (fi), NULL, &func_addr, &func_end))
+	xstormy16_scan_prologue (func_addr, get_frame_pc (fi), fi, NULL);
+      /* Else we're out of luck (can't debug completely stripped code). 
+         FIXME. */
+    }
+}
+
+/* Function: xstormy16_frame_saved_pc
+   Returns the return address for the selected frame. 
+   Called by frame_info, legacy_frame_chain_valid, and sometimes by
+   get_prev_frame.  */
+
+static CORE_ADDR
+xstormy16_frame_saved_pc (struct frame_info *fi)
+{
+  CORE_ADDR saved_pc;
+
+  if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+    {
+      saved_pc = deprecated_read_register_dummy (get_frame_pc (fi),
+						 get_frame_base (fi),
+						 E_PC_REGNUM);
+    }
+  else
+    {
+      saved_pc = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM],
+					       xstormy16_pc_size);
+    }
+
+  return saved_pc;
+}
+
+/* Function: xstormy16_init_extra_frame_info
+   This is the constructor function for the frame_info struct, 
+   called whenever a new frame_info is created (from create_new_frame,
+   and from get_prev_frame).
+*/
+
+static void
+xstormy16_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+{
+  if (!get_frame_extra_info (fi))
+    {
+      frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
+      get_frame_extra_info (fi)->framesize = 0;
+      get_frame_extra_info (fi)->frameless_p = 1;	/* Default frameless, detect framed */
+
+      /* By default, the fi->frame is set to the value of the FP reg by gdb.
+         This may not always be right; we may be in a frameless function,
+         or we may be in the prologue, before the FP has been set up.
+         Unfortunately, we can't make this determination without first
+         calling scan_prologue, and we can't do that unles we know the
+         get_frame_pc (fi).  */
+
+      if (!get_frame_pc (fi))
+	{
+	  /* Sometimes we are called from get_prev_frame without
+	     the PC being set up first.  Long history, don't ask.
+	     Fortunately this will never happen from the outermost
+	     frame, so we should be able to get the saved pc from
+	     the next frame. */
+	  if (get_next_frame (fi))
+	    deprecated_update_frame_pc_hack (fi, xstormy16_frame_saved_pc (get_next_frame (fi)));
+	}
+
+      /* Take care of the saved_regs right here (non-lazy). */
+      xstormy16_frame_init_saved_regs (fi);
+    }
+}
+
+/* Function: xstormy16_frame_chain
+   Returns a pointer to the stack frame of the calling function.
+   Called only from get_prev_frame.  Needed for backtrace, "up", etc.
+*/
+
+static CORE_ADDR
+xstormy16_frame_chain (struct frame_info *fi)
+{
+  if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
+    {
+      /* Call dummy's frame is the same as caller's.  */
+      return get_frame_base (fi);
+    }
+  else
+    {
+      /* Return computed offset from this frame's fp. */
+      return get_frame_base (fi) - get_frame_extra_info (fi)->framesize;
+    }
+}
+
+static int
+xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
+{
+  return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 &&
+    (get_frame_extra_info (thisframe)->frameless_p ||
+     get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain);
+}
+
+/* Function: xstormy16_saved_pc_after_call Returns the previous PC
+   immediately after a function call.  This function is meant to
+   bypass the regular frame_register() mechanism, ie. it is meant to
+   work even if the frame isn't complete.  Called by
+   step_over_function, and sometimes by get_prev_frame.  */
+
+static CORE_ADDR
+xstormy16_saved_pc_after_call (struct frame_info *ignore)
+{
+  CORE_ADDR sp, pc, tmp;
+
+  sp = read_register (E_SP_REGNUM) - xstormy16_pc_size;
+  pc = read_memory_integer (sp, xstormy16_pc_size);
+
+  /* Skip over jump table entry if necessary.  */
+  if ((tmp = SKIP_TRAMPOLINE_CODE (pc)))
+    pc = tmp;
+
+  return pc;
+}
+
 const static unsigned char *
 xstormy16_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
@@ -550,6 +1013,7 @@
 	  for (addr = osect->addr;
 	       addr < osect->endaddr; addr += 2 * xstormy16_inst_size)
 	    {
+	      int status;
 	      LONGEST inst, inst2, faddr2;
 	      char buf[2 * xstormy16_inst_size];
 
@@ -570,7 +1034,7 @@
 static CORE_ADDR
 xstormy16_skip_trampoline_code (CORE_ADDR pc)
 {
-  CORE_ADDR tmp = xstormy16_resolve_jmp_table_entry (pc);
+  int tmp = xstormy16_resolve_jmp_table_entry (pc);
 
   if (tmp && tmp != pc)
     return tmp;
@@ -583,13 +1047,6 @@
   return xstormy16_skip_trampoline_code (pc) != 0;
 }
 
-/* Function pointers are 16 bit.  The address space is 24 bit, using
-   32 bit addresses.  Pointers to functions on the XStormy16 are implemented
-   by using 16 bit pointers, which are either direct pointers in case the
-   function begins below 0x10000, or indirect pointers into a jump table.
-   The next two functions convert 16 bit pointers into 24 (32) bit addresses
-   and vice versa.  */
-
 static CORE_ADDR
 xstormy16_pointer_to_address (struct type *type, const void *buf)
 {
@@ -620,164 +1077,20 @@
   store_unsigned_integer (buf, TYPE_LENGTH (type), addr);
 }
 
-static struct xstormy16_frame_cache *
-xstormy16_alloc_frame_cache (void)
+static CORE_ADDR
+xstormy16_stack_align (CORE_ADDR addr)
 {
-  struct xstormy16_frame_cache *cache;
-  int i;
-
-  cache = FRAME_OBSTACK_ZALLOC (struct xstormy16_frame_cache);
-
-  cache->base = 0;
-  cache->saved_sp = 0;
-  cache->pc = 0;
-  cache->uses_fp = 0;
-  cache->framesize = 0;
-  for (i = 0; i < E_NUM_REGS; ++i)
-    cache->saved_regs[i] = REG_UNAVAIL;
-
-  return cache;
-}
-
-static struct xstormy16_frame_cache *
-xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
-{
-  struct xstormy16_frame_cache *cache;
-  CORE_ADDR current_pc;
-  int i;
-
-  if (*this_cache)
-    return *this_cache;
-
-  cache = xstormy16_alloc_frame_cache ();
-  *this_cache = cache;
-
-  cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
-  if (cache->base == 0)
-    return cache;
-
-  cache->pc = frame_func_unwind (next_frame);
-  current_pc = frame_pc_unwind (next_frame);
-  if (cache->pc)
-    xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame);
-
-  if (!cache->uses_fp)
-    cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-
-  cache->saved_sp = cache->base - cache->framesize;
-
-  for (i = 0; i < E_NUM_REGS; ++i)
-    if (cache->saved_regs[i] != REG_UNAVAIL)
-      cache->saved_regs[i] += cache->saved_sp;
-
-  return cache;
+  if (addr & 1)
+    ++addr;
+  return addr;
 }
 
 static void
-xstormy16_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			       int regnum, int *optimizedp,
-			       enum lval_type *lvalp, CORE_ADDR *addrp,
-			       int *realnump, void *valuep)
+xstormy16_save_dummy_frame_tos (CORE_ADDR sp)
 {
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
-                                                               this_cache);
-  gdb_assert (regnum >= 0);
-
-  if (regnum == E_SP_REGNUM && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-        {
-          /* Store the value.  */
-          store_unsigned_integer (valuep, xstormy16_reg_size, cache->saved_sp);
-        }
-      return;
-    }
-
-  if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
-      if (valuep)
-        {
-          /* Read the value in from memory.  */
-          read_memory (*addrp, valuep,
-                       register_size (current_gdbarch, regnum));
-        }
-      return;
-    }
-
-  frame_register_unwind (next_frame, regnum,
-                         optimizedp, lvalp, addrp, realnump, valuep);
+  generic_save_dummy_frame_tos (sp - xstormy16_pc_size);
 }
 
-static void
-xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache,
-			 struct frame_id *this_id)
-{
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
-							       this_cache);
-
-  /* This marks the outermost frame.  */
-  if (cache->base == 0)
-    return;
-
-  *this_id = frame_id_build (cache->saved_sp, cache->pc);
-}
-
-static CORE_ADDR
-xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache)
-{
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
-							       this_cache);
-  return cache->base;
-}
-
-static const struct frame_unwind xstormy16_frame_unwind = {
-  NORMAL_FRAME,
-  xstormy16_frame_this_id,
-  xstormy16_frame_prev_register
-};
-
-static const struct frame_base xstormy16_frame_base = {
-  &xstormy16_frame_unwind,
-  xstormy16_frame_base_address,
-  xstormy16_frame_base_address,
-  xstormy16_frame_base_address
-};
-
-static const struct frame_unwind *
-xstormy16_frame_sniffer (struct frame_info *next_frame)
-{
-  return &xstormy16_frame_unwind;
-}
-
-static CORE_ADDR
-xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
-static CORE_ADDR
-xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
-static struct frame_id
-xstormy16_unwind_dummy_id (struct gdbarch *gdbarch,
-			   struct frame_info *next_frame)
-{
-  return frame_id_build (xstormy16_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
-}
-
-
 /* Function: xstormy16_gdbarch_init
    Initializer function for the xstormy16 gdbarch vector.
    Called by gdbarch.  Sets up the gdbarch vector(s) for this target. */
@@ -785,6 +1098,7 @@
 static struct gdbarch *
 xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
+  struct gdbarch_tdep *tdep = NULL;
   struct gdbarch *gdbarch;
 
   /* find a candidate among the list of pre-declared architectures. */
@@ -792,69 +1106,92 @@
   if (arches != NULL)
     return (arches->gdbarch);
 
-  gdbarch = gdbarch_alloc (&info, NULL);
+#if 0
+  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+#endif
+
+  gdbarch = gdbarch_alloc (&info, 0);
+
+  /* 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()).  */
+  set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default);
 
   /*
-   * Basic register fields and methods, datatype sizes and stuff.
+   * Basic register fields and methods.
    */
 
   set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
   set_gdbarch_num_pseudo_regs (gdbarch, 0);
   set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
+  set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
   set_gdbarch_register_name (gdbarch, xstormy16_register_name);
-  set_gdbarch_register_type (gdbarch, xstormy16_register_type);
-
-  set_gdbarch_char_signed (gdbarch, 0);
-  set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-  set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-  set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-  set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-
-  set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-  set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-  set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-
-  set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-  set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-
-  set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
-  set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
-
-  set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
-
-  /* Stack grows up. */
-  set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
+  set_gdbarch_deprecated_register_size (gdbarch, xstormy16_reg_size);
+  set_gdbarch_deprecated_register_byte (gdbarch, xstormy16_register_byte);
+  set_gdbarch_deprecated_register_raw_size (gdbarch, xstormy16_register_raw_size);
+  set_gdbarch_deprecated_register_virtual_size (gdbarch, xstormy16_register_raw_size);
+  set_gdbarch_deprecated_register_virtual_type (gdbarch, xstormy16_reg_virtual_type);
 
   /*
    * Frame Info
    */
-  set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, xstormy16_unwind_dummy_id);
-  set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
-  frame_base_set_default (gdbarch, &xstormy16_frame_base);
-
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
+				     xstormy16_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
+				     xstormy16_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_chain (gdbarch, xstormy16_frame_chain);
+  set_gdbarch_deprecated_get_saved_register (gdbarch, xstormy16_get_saved_register);
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call);
+  set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc);
   set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue);
+  set_gdbarch_deprecated_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid);
+
   set_gdbarch_in_function_epilogue_p (gdbarch,
 				      xstormy16_in_function_epilogue_p);
 
-  /* These values and methods are used when gdb calls a target function.  */
-  set_gdbarch_push_dummy_call (gdbarch, xstormy16_push_dummy_call);
+  /* 
+   * Miscelany
+   */
+  /* Stack grows up. */
+  set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
+
+  /*
+   * Call Dummies
+   * 
+   * These values and methods are used when gdb calls a target function.  */
+  set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
+  set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments);
+  set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame);
+  set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return);
+  set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
+  set_gdbarch_deprecated_use_struct_convention (gdbarch, xstormy16_use_struct_convention);
   set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
-  set_gdbarch_return_value (gdbarch, xstormy16_return_value);
+
+  set_gdbarch_char_signed (gdbarch, 0);
+  set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+  set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+
+  set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
+  set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
+
+  set_gdbarch_deprecated_stack_align (gdbarch, xstormy16_stack_align);
+
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
 
   set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);
+
   set_gdbarch_in_solib_call_trampoline (gdbarch,
 					xstormy16_in_solib_call_trampoline);
 
+  /* Should be using push_dummy_call.  */
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
+
   set_gdbarch_print_insn (gdbarch, print_insn_xstormy16);
 
-  gdbarch_init_osabi (info, gdbarch);
-
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, xstormy16_frame_sniffer);
-
   return gdbarch;
 }
 
diff --git a/include/ChangeLog b/include/ChangeLog
index 5f7d368..b6c1156 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,118 +1,3 @@
-2004-10-12  Paul Brook  <paul@codesourcery.com>
-
-	* elf/arm.h (EF_ARM_EABI_VER4): Define.
-
-2004-10-08  Daniel Jacobowitz  <dan@debian.org>
-
-	* elf/common.h (PT_SUNW_EH_FRAME): Define.
-	* elf/x86-64.h (SHT_X86_64_UNWIND): Define.
-
-2004-10-07  Bob Wilson  <bob.wilson@acm.org>
-
-	* xtensa-config.h (XSHAL_USE_ABSOLUTE_LITERALS,
-	XCHAL_HAVE_PREDICTED_BRANCHES, XCHAL_INST_FETCH_WIDTH): New.
-	(XCHAL_EXTRA_SA_SIZE, XCHAL_EXTRA_SA_ALIGN): Delete.
-
-	* xtensa-isa-internal.h (ISA_INTERFACE_VERSION): Delete.
-	(config_sturct struct): Delete.
-	(XTENSA_OPERAND_IS_REGISTER, XTENSA_OPERAND_IS_PCRELATIVE,
-	XTENSA_OPERAND_IS_INVISIBLE, XTENSA_OPERAND_IS_UNKNOWN,
-	XTENSA_OPCODE_IS_BRANCH, XTENSA_OPCODE_IS_JUMP,
-	XTENSA_OPCODE_IS_LOOP, XTENSA_OPCODE_IS_CALL,
-	XTENSA_STATE_IS_EXPORTED, XTENSA_INTERFACE_HAS_SIDE_EFFECT): Define.
-	(xtensa_format_encode_fn, xtensa_get_slot_fn, xtensa_set_slot_fn): New.
-	(xtensa_insn_decode_fn): Rename to ...
-	(xtensa_opcode_decode_fn): ... this.
-	(xtensa_immed_decode_fn, xtensa_immed_encode_fn, xtensa_do_reloc_fn,
-	xtensa_undo_reloc_fn): Update.
-	(xtensa_encoding_template_fn): Delete.
-	(xtensa_opcode_encode_fn, xtensa_format_decode_fn,
-	xtensa_length_decode_fn): New.
-	(xtensa_format_internal, xtensa_slot_internal): New types.
-	(xtensa_operand_internal): Delete operand_kind, inout, isPCRelative,
-	get_field, and set_field fields.  Add name, field_id, regfile,
-	num_regs, and flags fields.
-	(xtensa_arg_internal): New type.
-	(xtensa_iclass_internal): Change operands field to array of
-	xtensa_arg_internal.  Add num_stateOperands, stateOperands,
-	num_interfaceOperands, and interfaceOperands fields.
-	(xtensa_opcode_internal): Delete length, template, and iclass fields.
-	Add iclass_id, flags, encode_fns, num_funcUnit_uses, and funcUnit_uses.
-	(opname_lookup_entry): Delete.
-	(xtensa_regfile_internal, xtensa_interface_internal,
-	xtensa_funcUnit_internal, xtensa_state_internal,
-	xtensa_sysreg_internal, xtensa_lookup_entry): New.
-	(xtensa_isa_internal): Replace opcode_table field with opcodes field.
-	Change type of opname_lookup_table.  Delete num_modules,
-	module_opcode_base, module_decode_fn, config, and has_density fields.
-	Add num_formats, formats, format_decode_fn, length_decode_fn,
-	num_slots, slots, num_fields, num_operands, operands, num_iclasses,
-	iclasses, num_regfiles, regfiles, num_states, states,
-	state_lookup_table, num_sysregs, sysregs, sysreg_lookup_table,
-	max_sysreg_num, sysreg_table, num_interfaces, interfaces,
-	interface_lookup_table, num_funcUnits, funcUnits and
-	funcUnit_lookup_table fields.
-	(xtensa_isa_module, xtensa_isa_modules): Delete.
-	(xtensa_isa_name_compare): New prototype.
-	(xtisa_errno, xtisa_error_msg): New.
-	* xtensa-isa.h (XTENSA_ISA_VERSION): Define.
-	(xtensa_isa): Change type.
-	(xtensa_operand): Delete.
-	(xtensa_format, xtensa_regfile, xtensa_state, xtensa_sysreg,
-	xtensa_interface, xtensa_funcUnit, xtensa_isa_status,
-	xtensa_funcUnit_use): New types.
-	(libisa_module_specifier): Delete.
-	(xtensa_isa_errno, xtensa_isa_error_msg): New prototypes.
-	(xtensa_insnbuf_free, xtensa_insnbuf_to_chars,
-	xtensa_insnbuf_from_chars): Update prototypes.
-	(xtensa_load_isa, xtensa_extend_isa, xtensa_default_isa,
-	xtensa_insn_maxlength, xtensa_num_opcodes, xtensa_decode_insn,
-	xtensa_encode_insn, xtensa_insn_length,
-	xtensa_insn_length_from_first_byte, xtensa_num_operands,
-	xtensa_operand_kind, xtensa_encode_result,
-	xtensa_operand_isPCRelative): Delete.
-	(xtensa_isa_init, xtensa_operand_inout, xtensa_operand_get_field,
-	xtensa_operand_set_field, xtensa_operand_encode,
-	xtensa_operand_decode, xtensa_operand_do_reloc,
-	xtensa_operand_undo_reloc): Update prototypes.
-	(xtensa_isa_maxlength, xtensa_isa_length_from_chars,
-	xtensa_isa_num_pipe_stages, xtensa_isa_num_formats,
-	xtensa_isa_num_opcodes, xtensa_isa_num_regfiles, xtensa_isa_num_states,
-	xtensa_isa_num_sysregs, xtensa_isa_num_interfaces,
-	xtensa_isa_num_funcUnits, xtensa_format_name, xtensa_format_lookup,
-	xtensa_format_decode, xtensa_format_encode, xtensa_format_length,
-	xtensa_format_num_slots, xtensa_format_slot_nop_opcode,
-	xtensa_format_get_slot, xtensa_format_set_slot, xtensa_opcode_decode,
-	xtensa_opcode_encode, xtensa_opcode_is_branch, xtensa_opcode_is_jump,
-	xtensa_opcode_is_loop, xtensa_opcode_is_call,
-	xtensa_opcode_num_operands, xtensa_opcode_num_stateOperands,
-	xtensa_opcode_num_interfaceOperands, xtensa_opcode_num_funcUnit_uses,
-	xtensa_opcode_funcUnit_use, xtensa_operand_name,
-	xtensa_operand_is_visible, xtensa_operand_is_register,
-	xtensa_operand_regfile, xtensa_operand_num_regs,
-	xtensa_operand_is_known_reg, xtensa_operand_is_PCrelative,
-	xtensa_stateOperand_state, xtensa_stateOperand_inout,
-	xtensa_interfaceOperand_interface, xtensa_regfile_lookup,
-	xtensa_regfile_lookup_shortname, xtensa_regfile_name,
-	xtensa_regfile_shortname, xtensa_regfile_view_parent,
-	xtensa_regfile_num_bits, xtensa_regfile_num_entries,
-	xtensa_state_lookup, xtensa_state_name, xtensa_state_num_bits,
-	xtensa_state_is_exported, xtensa_sysreg_lookup,
-	xtensa_sysreg_lookup_name, xtensa_sysreg_name, xtensa_sysreg_number,
-	xtensa_sysreg_is_user, xtensa_interface_lookup, xtensa_interface_name,
-	xtensa_interface_num_bits, xtensa_interface_inout,
-	xtensa_interface_has_side_effect, xtensa_funcUnit_lookup,
-	xtensa_funcUnit_name, xtensa_funcUnit_num_copies): New prototypes.
-	* elf/xtensa.h (R_XTENSA_DIFF8, R_XTENSA_DIFF16, R_XTENSA_DIFF32,
-	R_XTENSA_SLOT*_OP, R_XTENSA_SLOT*_ALT): New relocations.
-	(XTENSA_PROP_SEC_NAME): Define.
-	(property_table_entry): Add flags field.
-	(XTENSA_PROP_*, GET_XTENSA_PROP_*, SET_XTENSA_PROP_*): Define.
-
-2004-10-07  Jeff Baker  <jbaker@qnx.com>
-
-	* bfdlink.h (bfd_link_info): Add bitfield: warn_shared_textrel.
-
 2004-09-17  Paul Brook  <paul@codesourcery.com>
 
 	* elf/arm.h: Remove R_ARM_STKCHK and R_ARM_THM_STKCHK.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index db276b0..5aa72d4 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -308,9 +308,6 @@
   /* TRUE if PT_GNU_RELRO segment should be created.  */
   unsigned int relro: 1;
 
-  /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
-  unsigned int warn_shared_textrel: 1;
-
   /* What to do with unresolved symbols in an object file.
      When producing executables the default is GENERATE_ERROR.
      When producing shared libraries the default is IGNORE.  The
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 7b537b4..6b0cf0d 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,14 +1,3 @@
-2004-10-06  Eric Christopher  <echristo@redhat.com>
-
-	* dwarf2.h: Sync with gcc dwarf2.h. Fix typo.
-
-2004-10-01  Paul Brook  <paul@codesourcery.com>
-
-	* arm.h (SHT_ARM_EXIDX): Define.
-	(ELF_STRING_ARM_unwind, ELF_STRING_ARM_unwind,
-	ELF_STRING_ARM_unwind_once, ELF_STRING_ARM_unwind_info_once):
-	Define.
-
 2004-08-25  Dmitry Diky  <diwil@spec.ru>
 
 	* msp430.h: Add new relocs.
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 9055f62..05ba346 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -51,7 +51,6 @@
 #define EF_ARM_EABI_VER1     0x01000000
 #define EF_ARM_EABI_VER2     0x02000000
 #define EF_ARM_EABI_VER3     0x03000000
-#define EF_ARM_EABI_VER4     0x04000000
 
 /* Local aliases for some flags to match names used by COFF port.  */
 #define F_INTERWORK	   EF_ARM_INTERWORK
@@ -65,9 +64,6 @@
 #define STT_ARM_TFUNC      STT_LOPROC   /* A Thumb function.  */
 #define STT_ARM_16BIT      STT_HIPROC   /* A Thumb label.  */
 
-/* Additional section types.  */
-#define SHT_ARM_EXIDX	   0x70000001	/* Section holds ARM unwind info.  */
-
 /* ARM-specific values for sh_flags.  */
 #define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point.  */
 #define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step.  */
@@ -161,11 +157,5 @@
 
 /* The name of the note section used to identify arm variants.  */
 #define ARM_NOTE_SECTION ".note.gnu.arm.ident"
-
-/* Special section names.  */
-#define ELF_STRING_ARM_unwind           ".ARM.exidx"
-#define ELF_STRING_ARM_unwind_info      ".ARM.extab"
-#define ELF_STRING_ARM_unwind_once      ".gnu.linkonce.armexidx."
-#define ELF_STRING_ARM_unwind_info_once ".gnu.linkonce.armextab."
-
+     
 #endif /* _ELF_ARM_H */
diff --git a/include/elf/common.h b/include/elf/common.h
index db92ff6..5573fca 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -290,7 +290,6 @@
 #define PT_HIPROC	0x7FFFFFFF	/* Processor-specific */
 
 #define PT_GNU_EH_FRAME	(PT_LOOS + 0x474e550) /* Frame unwind information */
-#define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
 #define PT_GNU_STACK	(PT_LOOS + 0x474e551) /* Stack flags */
 #define PT_GNU_RELRO	(PT_LOOS + 0x474e552) /* Read-only after relocation */
 
diff --git a/include/elf/dwarf2.h b/include/elf/dwarf2.h
index 9458907..bede7e2 100644
--- a/include/elf/dwarf2.h
+++ b/include/elf/dwarf2.h
@@ -4,7 +4,7 @@
    2003 Free Software Foundation, Inc.
 
    Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
-   Office (AJPO), Florida State University and Silicon Graphics Inc.
+   Office (AJPO), Florida State Unviversity and Silicon Graphics Inc.
    provided support for this effort -- June 21, 1995.
 
    Derived from the DWARF 1 implementation written by Ron Guilmette
@@ -605,8 +605,7 @@
   {
     DW_CC_normal = 0x1,
     DW_CC_program = 0x2,
-    DW_CC_nocall = 0x3,
-    DW_CC_GNU_renesas_sh = 0x40
+    DW_CC_nocall = 0x3
   };
 
 #define DW_CC_lo_user 0x40
diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h
index 2252bd0..7e9100d 100644
--- a/include/elf/x86-64.h
+++ b/include/elf/x86-64.h
@@ -53,8 +53,4 @@
      RELOC_NUMBER (R_X86_64_GNU_VTENTRY, 251)         /* GNU C++ hack  */
 END_RELOC_NUMBERS (R_X86_64_max)
 
-/* Processor specific section types.  */
-
-#define SHT_X86_64_UNWIND	0x70000001	/* unwind information */
-
 #endif
diff --git a/include/elf/xtensa.h b/include/elf/xtensa.h
index 14f9913..6c584c7 100644
--- a/include/elf/xtensa.h
+++ b/include/elf/xtensa.h
@@ -1,5 +1,5 @@
 /* Xtensa ELF support for BFD.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
    Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -42,39 +42,6 @@
      RELOC_NUMBER (R_XTENSA_ASM_SIMPLIFY, 12)
      RELOC_NUMBER (R_XTENSA_GNU_VTINHERIT, 15)
      RELOC_NUMBER (R_XTENSA_GNU_VTENTRY, 16)
-     RELOC_NUMBER (R_XTENSA_DIFF8, 17)
-     RELOC_NUMBER (R_XTENSA_DIFF16, 18)
-     RELOC_NUMBER (R_XTENSA_DIFF32, 19)
-     RELOC_NUMBER (R_XTENSA_SLOT0_OP, 20)
-     RELOC_NUMBER (R_XTENSA_SLOT1_OP, 21)
-     RELOC_NUMBER (R_XTENSA_SLOT2_OP, 22)
-     RELOC_NUMBER (R_XTENSA_SLOT3_OP, 23)
-     RELOC_NUMBER (R_XTENSA_SLOT4_OP, 24)
-     RELOC_NUMBER (R_XTENSA_SLOT5_OP, 25)
-     RELOC_NUMBER (R_XTENSA_SLOT6_OP, 26)
-     RELOC_NUMBER (R_XTENSA_SLOT7_OP, 27)
-     RELOC_NUMBER (R_XTENSA_SLOT8_OP, 28)
-     RELOC_NUMBER (R_XTENSA_SLOT9_OP, 29)
-     RELOC_NUMBER (R_XTENSA_SLOT10_OP, 30)
-     RELOC_NUMBER (R_XTENSA_SLOT11_OP, 31)
-     RELOC_NUMBER (R_XTENSA_SLOT12_OP, 32)
-     RELOC_NUMBER (R_XTENSA_SLOT13_OP, 33)
-     RELOC_NUMBER (R_XTENSA_SLOT14_OP, 34)
-     RELOC_NUMBER (R_XTENSA_SLOT0_ALT, 35)
-     RELOC_NUMBER (R_XTENSA_SLOT1_ALT, 36)
-     RELOC_NUMBER (R_XTENSA_SLOT2_ALT, 37)
-     RELOC_NUMBER (R_XTENSA_SLOT3_ALT, 38)
-     RELOC_NUMBER (R_XTENSA_SLOT4_ALT, 39)
-     RELOC_NUMBER (R_XTENSA_SLOT5_ALT, 40)
-     RELOC_NUMBER (R_XTENSA_SLOT6_ALT, 41)
-     RELOC_NUMBER (R_XTENSA_SLOT7_ALT, 42)
-     RELOC_NUMBER (R_XTENSA_SLOT8_ALT, 43)
-     RELOC_NUMBER (R_XTENSA_SLOT9_ALT, 44)
-     RELOC_NUMBER (R_XTENSA_SLOT10_ALT, 45)
-     RELOC_NUMBER (R_XTENSA_SLOT11_ALT, 46)
-     RELOC_NUMBER (R_XTENSA_SLOT12_ALT, 47)
-     RELOC_NUMBER (R_XTENSA_SLOT13_ALT, 48)
-     RELOC_NUMBER (R_XTENSA_SLOT14_ALT, 49)
 END_RELOC_NUMBERS (R_XTENSA_max)
 
 /* Processor-specific flags for the ELF header e_flags field.  */
@@ -111,88 +78,11 @@
 
 #define XTENSA_INSN_SEC_NAME ".xt.insn"
 #define XTENSA_LIT_SEC_NAME  ".xt.lit"
-#define XTENSA_PROP_SEC_NAME ".xt.prop"
 
 typedef struct property_table_entry_t
 {
   bfd_vma address;
   bfd_vma size;
-  flagword flags;
 } property_table_entry;
 
-/* Flags in the property tables to specify whether blocks of memory are
-   literals, instructions, data, or unreachable.  For instructions,
-   blocks that begin loop targets and branch targets are designated.
-   Blocks that do not allow density instructions, instruction reordering
-   or transformation are also specified.  Finally, for branch targets,
-   branch target alignment priority is included.  Alignment of the next
-   block is specified in the current block and the size of the current
-   block does not include any fill required to align to the next
-   block.  */
-   
-#define XTENSA_PROP_LITERAL		0x00000001
-#define XTENSA_PROP_INSN		0x00000002
-#define XTENSA_PROP_DATA		0x00000004
-#define XTENSA_PROP_UNREACHABLE		0x00000008
-/* Instruction-only properties at beginning of code. */
-#define XTENSA_PROP_INSN_LOOP_TARGET	0x00000010
-#define XTENSA_PROP_INSN_BRANCH_TARGET	0x00000020
-/* Instruction-only properties about code. */
-#define XTENSA_PROP_INSN_NO_DENSITY	0x00000040
-#define XTENSA_PROP_INSN_NO_REORDER	0x00000080
-#define XTENSA_PROP_INSN_NO_TRANSFORM	0x00000100
-
-/*  Branch target alignment information.  This transmits information
-    to the linker optimization about the priority of aligning a
-    particular block for branch target alignment: None, low priority,
-    high priority, or required.  These only need to be checked in
-    instruction blocks marked as XTENSA_PROP_INSN_BRANCH_TARGET.
-    Common usage is:
-
-    switch (GET_XTENSA_PROP_BT_ALIGN(flags))
-    case XTENSA_PROP_BT_ALIGN_NONE:
-    case XTENSA_PROP_BT_ALIGN_LOW:
-    case XTENSA_PROP_BT_ALIGN_HIGH:
-    case XTENSA_PROP_BT_ALIGN_REQUIRE:
-*/
-#define XTENSA_PROP_BT_ALIGN_MASK       0x00000600
-
-/* No branch target alignment.  */
-#define XTENSA_PROP_BT_ALIGN_NONE       0x0
-/* Low priority branch target alignment.  */
-#define XTENSA_PROP_BT_ALIGN_LOW        0x1
-/* High priority branch target alignment. */
-#define XTENSA_PROP_BT_ALIGN_HIGH       0x2
-/* Required branch target alignment.  */
-#define XTENSA_PROP_BT_ALIGN_REQUIRE    0x3
-
-#define GET_XTENSA_PROP_BT_ALIGN(flag) \
-  (((unsigned)((flag) & (XTENSA_PROP_BT_ALIGN_MASK))) >> 9)
-#define SET_XTENSA_PROP_BT_ALIGN(flag, align) \
-  (((flag) & (~XTENSA_PROP_BT_ALIGN_MASK)) | \
-    (((align) << 9) & XTENSA_PROP_BT_ALIGN_MASK))
-
-/* Alignment is specified in the block BEFORE the one that needs
-   alignment.  Up to 5 bits.  Use GET_XTENSA_PROP_ALIGNMENT(flags) to
-   get the required alignment specified as a power of 2.  Use
-   SET_XTENSA_PROP_ALIGNMENT(flags, pow2) to set the required
-   alignment.  Be careful of side effects since the SET will evaluate
-   flags twice.  Also, note that the SIZE of a block in the property
-   table does not include the alignment size, so the alignment fill
-   must be calculated to determine if two blocks are contiguous.
-   TEXT_ALIGN is not currently implemented but is a placeholder for a
-   possible future implementation.  */
-
-#define XTENSA_PROP_ALIGN		0x00000800
-
-#define XTENSA_PROP_ALIGNMENT_MASK      0x0001f000
-
-#define GET_XTENSA_PROP_ALIGNMENT(flag) \
-  (((unsigned)((flag) & (XTENSA_PROP_ALIGNMENT_MASK))) >> 12)
-#define SET_XTENSA_PROP_ALIGNMENT(flag, align) \
-  (((flag) & (~XTENSA_PROP_ALIGNMENT_MASK)) | \
-    (((align) << 12) & XTENSA_PROP_ALIGNMENT_MASK))
-
-#define XTENSA_PROP_INSN_ABSLIT        0x00020000
-
 #endif /* _ELF_XTENSA_H */
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 4eb8348..462165c 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,13 +1,3 @@
-2004-10-07  Tomer Levi  <Tomer.Levi@nsc.com>
-
-	* crx.h: Add COPS_REG_INS - Coprocessor Special register
-	instruction type.
-
-2004-09-30  Paul Brook  <paul@codesourcery.com>
-
-	* arm.h (ARM_EXT_V6K, ARM_EXT_V6Z): Define.
-	(ARM_ARCH_V6K, ARM_ARCH_V6Z, ARM_ARCH_V6ZK): Define.
-
 2004-09-11  Theodore A. Roth  <troth@openavr.org>
 
 	* avr.h: Add support for
diff --git a/include/opcode/arm.h b/include/opcode/arm.h
index dd90e2a..6ccccbd 100644
--- a/include/opcode/arm.h
+++ b/include/opcode/arm.h
@@ -32,8 +32,6 @@
 #define ARM_EXT_V5E	 0x00000400	/* DSP Double transfers.   */
 #define ARM_EXT_V5J	 0x00000800	/* Jazelle extension.	   */
 #define ARM_EXT_V6       0x00001000     /* ARM V6.                 */
-#define ARM_EXT_V6K      0x00002000     /* ARM V6K.                */
-#define ARM_EXT_V6Z      0x00004000     /* ARM V6Z.                */
 
 /* Co-processor space extensions.  */
 #define ARM_CEXT_XSCALE   0x00800000	/* Allow MIA etc.          */
@@ -62,9 +60,6 @@
 #define ARM_ARCH_V5TE	(ARM_ARCH_V5TExP | ARM_EXT_V5E)
 #define ARM_ARCH_V5TEJ	(ARM_ARCH_V5TE	| ARM_EXT_V5J)
 #define ARM_ARCH_V6     (ARM_ARCH_V5TEJ | ARM_EXT_V6)
-#define ARM_ARCH_V6K    (ARM_ARCH_V6    | ARM_EXT_V6K)
-#define ARM_ARCH_V6Z    (ARM_ARCH_V6    | ARM_EXT_V6Z)
-#define ARM_ARCH_V6ZK   (ARM_ARCH_V6    | ARM_EXT_V6K | ARM_EXT_V6Z)
 
 /* Processors with specific extensions in the co-processor space.  */
 #define ARM_ARCH_XSCALE	(ARM_ARCH_V5TE	| ARM_CEXT_XSCALE)
diff --git a/include/opcode/crx.h b/include/opcode/crx.h
index 58db2f8..1e0d573 100644
--- a/include/opcode/crx.h
+++ b/include/opcode/crx.h
@@ -168,10 +168,9 @@
 #define DIV_INS		 14
 #define COP_BRANCH_INS   15
 #define COP_REG_INS      16
-#define COPS_REG_INS     17
-#define DCR_BRANCH_INS   18
-#define MMC_INS          19
-#define MMU_INS          20
+#define DCR_BRANCH_INS   17
+#define MMC_INS          18
+#define MMU_INS          19
 
 /* Maximum value supported for instruction types.  */
 #define CRX_INS_MAX	(1 << 5)
diff --git a/include/xtensa-config.h b/include/xtensa-config.h
index 4ef5d64..4191c36 100644
--- a/include/xtensa-config.h
+++ b/include/xtensa-config.h
@@ -1,5 +1,5 @@
 /* Xtensa configuration settings.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2003 Free Software Foundation, Inc.
    Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
 
    This program is free software; you can redistribute it and/or modify
@@ -42,9 +42,6 @@
 #undef XCHAL_HAVE_L32R
 #define XCHAL_HAVE_L32R			1
 
-#undef XSHAL_USE_ABSOLUTE_LITERALS
-#define XSHAL_USE_ABSOLUTE_LITERALS	0
-
 #undef XCHAL_HAVE_MAC16
 #define XCHAL_HAVE_MAC16		0
 
@@ -90,9 +87,6 @@
 #undef XCHAL_HAVE_WINDOWED
 #define XCHAL_HAVE_WINDOWED		1
 
-#undef XCHAL_HAVE_PREDICTED_BRANCHES
-#define XCHAL_HAVE_PREDICTED_BRANCHES	0
-
 
 #undef XCHAL_ICACHE_SIZE
 #define XCHAL_ICACHE_SIZE		8192
@@ -136,7 +130,10 @@
 #define XCHAL_DEBUGLEVEL		4
 
 
-#undef XCHAL_INST_FETCH_WIDTH
-#define XCHAL_INST_FETCH_WIDTH		4
+#undef XCHAL_EXTRA_SA_SIZE
+#define XCHAL_EXTRA_SA_SIZE		0
+
+#undef XCHAL_EXTRA_SA_ALIGN
+#define XCHAL_EXTRA_SA_ALIGN		1
 
 #endif /* !XTENSA_CONFIG_H */
diff --git a/include/xtensa-isa-internal.h b/include/xtensa-isa-internal.h
index 50ac478..7f221ea 100644
--- a/include/xtensa-isa-internal.h
+++ b/include/xtensa-isa-internal.h
@@ -1,5 +1,5 @@
 /* Internal definitions for configurable Xtensa ISA support.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -17,215 +17,98 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifndef XTENSA_ISA_INTERNAL_H
-#define XTENSA_ISA_INTERNAL_H
+/* Use the statically-linked version for the GNU tools.  */
+#define STATIC_LIBISA 1
 
-/* Flags.  */
+#define ISA_INTERFACE_VERSION 3
 
-#define XTENSA_OPERAND_IS_REGISTER	0x00000001
-#define XTENSA_OPERAND_IS_PCRELATIVE	0x00000002
-#define XTENSA_OPERAND_IS_INVISIBLE	0x00000004
-#define XTENSA_OPERAND_IS_UNKNOWN	0x00000008
+struct config_struct
+{
+    char *param_name;
+    char *param_value;
+};
 
-#define XTENSA_OPCODE_IS_BRANCH		0x00000001
-#define XTENSA_OPCODE_IS_JUMP		0x00000002
-#define XTENSA_OPCODE_IS_LOOP		0x00000004
-#define XTENSA_OPCODE_IS_CALL		0x00000008
+/* Encode/decode function types for immediate operands.  */
+typedef uint32 (*xtensa_immed_decode_fn) (uint32);
+typedef xtensa_encode_result (*xtensa_immed_encode_fn) (uint32 *);
 
-#define XTENSA_STATE_IS_EXPORTED	0x00000001
-
-#define XTENSA_INTERFACE_HAS_SIDE_EFFECT 0x00000001
-
-/* Function pointer typedefs */
-typedef void (*xtensa_format_encode_fn) (xtensa_insnbuf);
-typedef void (*xtensa_get_slot_fn) (const xtensa_insnbuf, xtensa_insnbuf);
-typedef void (*xtensa_set_slot_fn) (xtensa_insnbuf, const xtensa_insnbuf);
-typedef int (*xtensa_opcode_decode_fn) (const xtensa_insnbuf);
+/* Field accessor function types.  */
 typedef uint32 (*xtensa_get_field_fn) (const xtensa_insnbuf);
 typedef void (*xtensa_set_field_fn) (xtensa_insnbuf, uint32);
-typedef int (*xtensa_immed_decode_fn) (uint32 *);
-typedef int (*xtensa_immed_encode_fn) (uint32 *);
-typedef int (*xtensa_do_reloc_fn) (uint32 *, uint32);
-typedef int (*xtensa_undo_reloc_fn) (uint32 *, uint32);
-typedef void (*xtensa_opcode_encode_fn) (xtensa_insnbuf);
-typedef int (*xtensa_format_decode_fn) (const xtensa_insnbuf);
-typedef int (*xtensa_length_decode_fn) (const char *);
 
-typedef struct xtensa_format_internal_struct
-{
-  const char *name;			/* Instruction format name.  */
-  int length;				/* Instruction length in bytes.  */
-  xtensa_format_encode_fn encode_fn;
-  int num_slots;
-  int *slot_id;				/* Array[num_slots] of slot IDs.  */
-} xtensa_format_internal;
+/* PC-relative relocation function types.  */
+typedef uint32 (*xtensa_do_reloc_fn) (uint32, uint32);
+typedef uint32 (*xtensa_undo_reloc_fn) (uint32, uint32);
 
-typedef struct xtensa_slot_internal_struct
-{
-  const char *name;			/* Not necessarily unique.  */
-  const char *format;
-  int position;
-  xtensa_get_slot_fn get_fn;
-  xtensa_set_slot_fn set_fn;
-  xtensa_get_field_fn *get_field_fns;	/* Array[field_id].  */
-  xtensa_set_field_fn *set_field_fns;	/* Array[field_id].  */
-  xtensa_opcode_decode_fn opcode_decode_fn;
-  const char *nop_name;
-} xtensa_slot_internal;
+/* Instruction decode function type.  */
+typedef int (*xtensa_insn_decode_fn) (const xtensa_insnbuf);
+
+/* Instruction encoding template function type (each of these functions
+   returns a constant template; they exist only to make it easier for the
+   TIE compiler to generate endian-independent DLLs).  */
+typedef xtensa_insnbuf (*xtensa_encoding_template_fn) (void);
+
 
 typedef struct xtensa_operand_internal_struct
 {
-  const char *name;
-  int field_id;
-  xtensa_regfile regfile;		/* Register file.  */
-  int num_regs;				/* Usually 1; 2 for reg pairs, etc.  */
-  uint32 flags;				/* See XTENSA_OPERAND_* flags.  */
+  char *operand_kind;			/* e.g., "a", "f", "i", "l"....  */
+  char inout;				/* '<', '>', or '='.  */
+  char isPCRelative;			/* Is this a PC-relative offset?  */
+  xtensa_get_field_fn get_field;	/* Get encoded value of the field.  */
+  xtensa_set_field_fn set_field;	/* Set field with an encoded value.  */
   xtensa_immed_encode_fn encode;	/* Encode the operand value.  */
   xtensa_immed_decode_fn decode;	/* Decode the value from the field.  */
-  xtensa_do_reloc_fn do_reloc;		/* Perform a PC-relative reloc.  */
+  xtensa_do_reloc_fn do_reloc;		/* Perform a PC-relative relocation.  */
   xtensa_undo_reloc_fn undo_reloc;	/* Undo a PC-relative relocation.  */
 } xtensa_operand_internal;
 
-typedef struct xtensa_arg_internal_struct
-{
-  union {
-    int operand_id;			/* For normal operands.  */
-    xtensa_state state;			/* For stateOperands.  */
-  } u;
-  char inout;				/* Direction: 'i', 'o', or 'm'.  */
-} xtensa_arg_internal;
 
 typedef struct xtensa_iclass_internal_struct
 {
   int num_operands;			/* Size of "operands" array.  */
-  xtensa_arg_internal *operands;	/* Array[num_operands].  */
-
-  int num_stateOperands;		/* Size of "stateOperands" array.  */
-  xtensa_arg_internal *stateOperands;	/* Array[num_stateOperands].  */
-
-  int num_interfaceOperands;		/* Size of "interfaceOperands".  */
-  xtensa_interface *interfaceOperands;	/* Array[num_interfaceOperands].  */
+  xtensa_operand_internal **operands;	/* Array of operand structures.  */
 } xtensa_iclass_internal;
 
+
 typedef struct xtensa_opcode_internal_struct
 {
   const char *name;			/* Opcode mnemonic.  */
-  int iclass_id;			/* Iclass for this opcode.  */
-  uint32 flags;				/* See XTENSA_OPCODE_* flags.  */
-  xtensa_opcode_encode_fn *encode_fns;	/* Array[slot_id].  */
-  int num_funcUnit_uses;		/* Number of funcUnit_use entries.  */
-  xtensa_funcUnit_use *funcUnit_uses;	/* Array[num_funcUnit_uses].  */
+  int length;				/* Length in bytes of the insn.  */
+  xtensa_encoding_template_fn template;	/* Fn returning encoding template.  */
+  xtensa_iclass_internal *iclass;	/* Iclass for this opcode.  */
 } xtensa_opcode_internal;
 
-typedef struct xtensa_regfile_internal_struct
-{
-  const char *name;			/* Full name of the regfile.  */
-  const char *shortname;		/* Abbreviated name.  */
-  xtensa_regfile parent;		/* View parent (or identity).  */
-  int num_bits;				/* Width of the registers.  */
-  int num_entries;			/* Number of registers.  */
-} xtensa_regfile_internal;
 
-typedef struct xtensa_interface_internal_struct
+typedef struct opname_lookup_entry_struct
 {
-  const char *name;			/* Interface name.  */
-  int num_bits;				/* Width of the interface.  */
-  uint32 flags;				/* See XTENSA_INTERFACE_* flags.  */
-  char inout;				/* "i" or "o".  */
-} xtensa_interface_internal;
+  const char *key;			/* Opcode mnemonic.  */
+  xtensa_opcode opcode;			/* Internal opcode number.  */
+} opname_lookup_entry;
 
-typedef struct xtensa_funcUnit_internal_struct
-{
-  const char *name;			/* Functional unit name.  */
-  int num_copies;			/* Number of instances.  */
-} xtensa_funcUnit_internal;
-
-typedef struct xtensa_state_internal_struct
-{
-  const char *name;			/* State name.  */
-  int num_bits;				/* Number of state bits.  */
-  uint32 flags;				/* See XTENSA_STATE_* flags.  */
-} xtensa_state_internal;
-
-typedef struct xtensa_sysreg_internal_struct
-{
-  const char *name;			/* Register name.  */
-  int number;				/* Register number.  */
-  int is_user;				/* Non-zero if a "user register".  */
-} xtensa_sysreg_internal;
-
-typedef struct xtensa_lookup_entry_struct
-{
-  const char *key;
-  union
-  {
-    xtensa_opcode opcode;		/* Internal opcode number.  */
-    xtensa_sysreg sysreg;		/* Internal sysreg number.  */
-    xtensa_state state;			/* Internal state number.  */
-    xtensa_interface intf;		/* Internal interface number.  */
-    xtensa_funcUnit fun;		/* Internal funcUnit number.  */
-  } u;
-} xtensa_lookup_entry;
 
 typedef struct xtensa_isa_internal_struct
 {
   int is_big_endian;			/* Endianness.  */
   int insn_size;			/* Maximum length in bytes.  */
   int insnbuf_size;			/* Number of insnbuf_words.  */
-
-  int num_formats;
-  xtensa_format_internal *formats;
-  xtensa_format_decode_fn format_decode_fn;
-  xtensa_length_decode_fn length_decode_fn;
-
-  int num_slots;
-  xtensa_slot_internal *slots;
-
-  int num_fields;
-
-  int num_operands;
-  xtensa_operand_internal *operands;
-
-  int num_iclasses;
-  xtensa_iclass_internal *iclasses;
-
-  int num_opcodes;
-  xtensa_opcode_internal *opcodes;
-  xtensa_lookup_entry *opname_lookup_table;
-
-  int num_regfiles;
-  xtensa_regfile_internal *regfiles;
-
-  int num_states;
-  xtensa_state_internal *states;
-  xtensa_lookup_entry *state_lookup_table;
-
-  int num_sysregs;
-  xtensa_sysreg_internal *sysregs;
-  xtensa_lookup_entry *sysreg_lookup_table;
-
-  /* The current Xtensa ISA only supports 256 of each kind of sysreg so
-     we can get away with implementing lookups with tables indexed by
-     the register numbers.  If we ever allow larger sysreg numbers, this
-     may have to be reimplemented.  The first entry in the following
-     arrays corresponds to "special" registers and the second to "user"
-     registers.  */
-  int max_sysreg_num[2];
-  xtensa_sysreg *sysreg_table[2];
-
-  int num_interfaces;
-  xtensa_interface_internal *interfaces;
-  xtensa_lookup_entry *interface_lookup_table;
-
-  int num_funcUnits;
-  xtensa_funcUnit_internal *funcUnits;
-  xtensa_lookup_entry *funcUnit_lookup_table;
-
+  int num_opcodes;			/* Total number for all modules.  */
+  xtensa_opcode_internal **opcode_table;/* Indexed by internal opcode #.  */
+  int num_modules;			/* Number of modules (DLLs) loaded.  */
+  int *module_opcode_base;		/* Starting opcode # for each module.  */
+  xtensa_insn_decode_fn *module_decode_fn; /* Decode fn for each module.  */
+  opname_lookup_entry *opname_lookup_table; /* Lookup table for each module.  */
+  struct config_struct *config;		/* Table of configuration parameters.  */
+  int has_density;			/* Is density option available?  */
 } xtensa_isa_internal;
 
-extern int xtensa_isa_name_compare (const void *, const void *);
 
-extern xtensa_isa_status xtisa_errno;
-extern char xtisa_error_msg[];
+typedef struct xtensa_isa_module_struct
+{
+  int (*get_num_opcodes_fn) (void);
+  xtensa_opcode_internal **(*get_opcodes_fn) (void);
+  int (*decode_insn_fn) (const xtensa_insnbuf);
+  struct config_struct *(*get_config_table_fn) (void);
+} xtensa_isa_module;
 
-#endif /* !XTENSA_ISA_INTERNAL_H */
+extern xtensa_isa_module xtensa_isa_modules[];
+
diff --git a/include/xtensa-isa.h b/include/xtensa-isa.h
index 2dc11b9..54f750c 100644
--- a/include/xtensa-isa.h
+++ b/include/xtensa-isa.h
@@ -1,5 +1,5 @@
 /* Interface definition for configurable Xtensa ISA support.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -20,763 +20,209 @@
 #ifndef XTENSA_LIBISA_H
 #define XTENSA_LIBISA_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Use the statically-linked version for the GNU tools.  */
 #define STATIC_LIBISA 1
 
-/* Version number: This is intended to help support code that works with
-   versions of this library from multiple Xtensa releases.  */
-
-#define XTENSA_ISA_VERSION 7000
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #ifndef uint32
 #define uint32 unsigned int
 #endif
 
-/* This file defines the interface to the Xtensa ISA library.  This
-   library contains most of the ISA-specific information for a
-   particular Xtensa processor.  For example, the set of valid
-   instructions, their opcode encodings and operand fields are all
-   included here.
+/* This file defines the interface to the Xtensa ISA library.  This library
+   contains most of the ISA-specific information for a particular Xtensa
+   processor.  For example, the set of valid instructions, their opcode
+   encodings and operand fields are all included here.  To support Xtensa's
+   configurability and user-defined instruction extensions (i.e., TIE), the
+   library is initialized by loading one or more dynamic libraries; only a
+   small set of interface code is present in the statically-linked portion
+   of the library.
 
-   This interface basically defines a number of abstract data types.
+   This interface basically defines four abstract data types.
 
    . an instruction buffer - for holding the raw instruction bits
    . ISA info - information about the ISA as a whole
-   . instruction formats - instruction size and slot structure
-   . opcodes - information about individual instructions
-   . operands - information about register and immediate instruction operands
-   . stateOperands - information about processor state instruction operands
-   . interfaceOperands - information about interface instruction operands
-   . register files - register file information
-   . processor states - internal processor state information
-   . system registers - "special registers" and "user registers"
-   . interfaces - TIE interfaces that are external to the processor
-   . functional units - TIE shared functions
+   . opcode info - information about individual instructions
+   . operand info - information about specific instruction operands
 
-   The interface defines a set of functions to access each data type.
-   With the exception of the instruction buffer, the internal
-   representations of the data structures are hidden.  All accesses must
-   be made through the functions defined here.  */
+   It would be nice to implement these as classes in C++, but the library is
+   implemented in C to match the expectations of the GNU tools.
+   Instead, the interface defines a set of functions to access each data
+   type.  With the exception of the instruction buffer, the internal
+   representations of the data structures are hidden.  All accesses must be
+   made through the functions defined here.  */
 
-typedef struct xtensa_isa_opaque { int unused; } *xtensa_isa;
+typedef void* xtensa_isa;
+typedef void* xtensa_operand;
 
 
-/* Opcodes, formats, regfiles, states, sysregs, ctypes, and protos are
-   represented here using sequential integers beginning with 0.  The
-   specific values are only fixed for a particular instantiation of an
-   xtensa_isa structure, so these values should only be used
-   internally.  */
-
+/* Opcodes are represented here using sequential integers beginning with 0.
+   The specific value used for a particular opcode is only fixed for a
+   particular instantiation of an xtensa_isa structure, so these values
+   should only be used internally.  */
 typedef int xtensa_opcode;
-typedef int xtensa_format;
-typedef int xtensa_regfile;
-typedef int xtensa_state;
-typedef int xtensa_sysreg;
-typedef int xtensa_interface;
-typedef int xtensa_funcUnit;
 
-
-/* Define a unique value for undefined items.  */
-
+/* Define a unique value for undefined opcodes ("static const int" doesn't
+   seem to work for this because EGCS 1.0.3 on i686-Linux without -O won't
+   allow it to be used as an initializer).  */
 #define XTENSA_UNDEFINED -1
 
 
-/* Overview of using this interface to decode/encode instructions:
+typedef int libisa_module_specifier;
 
-   Each Xtensa instruction is associated with a particular instruction
-   format, where the format defines a fixed number of slots for
-   operations.  The formats for the core Xtensa ISA have only one slot,
-   but FLIX instructions may have multiple slots.  Within each slot,
-   there is a single opcode and some number of associated operands.
+extern xtensa_isa xtensa_isa_init (void);
 
-   The encoding and decoding functions operate on instruction buffers,
-   not on the raw bytes of the instructions.  The same instruction
-   buffer data structure is used for both entire instructions and
-   individual slots in those instructions -- the contents of a slot need
-   to be extracted from or inserted into the buffer for the instruction
-   as a whole.
 
-   Decoding an instruction involves first finding the format, which
-   identifies the number of slots, and then decoding each slot
-   separately.  A slot is decoded by finding the opcode and then using
-   the opcode to determine how many operands there are.  For example:
-
-   xtensa_insnbuf_from_chars
-   xtensa_format_decode
-   for each slot {
-     xtensa_format_get_slot
-     xtensa_opcode_decode
-     for each operand {
-       xtensa_operand_get_field
-       xtensa_operand_decode
-     }
-   }
-
-   Encoding an instruction is roughly the same procedure in reverse:
-
-   xtensa_format_encode
-   for each slot {
-     xtensa_opcode_encode
-     for each operand {
-       xtensa_operand_encode
-       xtensa_operand_set_field
-     }
-     xtensa_format_set_slot
-   }
-   xtensa_insnbuf_to_chars
-*/
-
-
-/* Error handling.  */
-
-/* Error codes.  The code for the most recent error condition can be
-   retrieved with the "errno" function.  For any result other than
-   xtensa_isa_ok, an error message containing additional information
-   about the problem can be retrieved using the "error_msg" function.
-   The error messages are stored in an internal buffer, which should not
-   should be freed and may be overwritten by subsequent operations.  */
-
-typedef enum xtensa_isa_status_enum
-{
-  xtensa_isa_ok = 0,
-  xtensa_isa_bad_format,
-  xtensa_isa_bad_slot,
-  xtensa_isa_bad_opcode,
-  xtensa_isa_bad_operand,
-  xtensa_isa_bad_field,
-  xtensa_isa_bad_iclass,
-  xtensa_isa_bad_regfile,
-  xtensa_isa_bad_sysreg,
-  xtensa_isa_bad_state,
-  xtensa_isa_bad_interface,
-  xtensa_isa_bad_funcUnit,
-  xtensa_isa_wrong_slot,
-  xtensa_isa_no_field,
-  xtensa_isa_out_of_memory,
-  xtensa_isa_buffer_overflow,
-  xtensa_isa_internal_error,
-  xtensa_isa_bad_value
-} xtensa_isa_status;
-
-extern xtensa_isa_status
-xtensa_isa_errno (xtensa_isa isa);
-
-extern char *
-xtensa_isa_error_msg (xtensa_isa isa);
-
-
 /* Instruction buffers.  */
 
 typedef uint32 xtensa_insnbuf_word;
 typedef xtensa_insnbuf_word *xtensa_insnbuf;
 
+/* Get the size in words of the xtensa_insnbuf array.  */
+extern int xtensa_insnbuf_size (xtensa_isa); 
 
-/* Get the size in "insnbuf_words" of the xtensa_insnbuf array.  */
+/* Allocate (with malloc) an xtensa_insnbuf of the right size.  */
+extern xtensa_insnbuf xtensa_insnbuf_alloc (xtensa_isa);
 
-extern int
-xtensa_insnbuf_size (xtensa_isa isa); 
+/* Release (with free) an xtensa_insnbuf of the right size.  */
+extern void xtensa_insnbuf_free (xtensa_insnbuf);
+
+/* Inward and outward conversion from memory images (byte streams) to our
+   internal instruction representation.  */
+extern void xtensa_insnbuf_to_chars (xtensa_isa, const xtensa_insnbuf,
+				     char *);
+
+extern void xtensa_insnbuf_from_chars (xtensa_isa, xtensa_insnbuf,
+				       const char *);
 
 
-/* Allocate an xtensa_insnbuf of the right size.  */
-
-extern xtensa_insnbuf
-xtensa_insnbuf_alloc (xtensa_isa isa);
-
-
-/* Release an xtensa_insnbuf.  */
-
-extern void
-xtensa_insnbuf_free (xtensa_isa isa, xtensa_insnbuf buf);
-
-
-/* Conversion between raw memory (char arrays) and our internal
-   instruction representation.  This is complicated by the Xtensa ISA's
-   variable instruction lengths.  When converting to chars, the buffer
-   must contain a valid instruction so we know how many bytes to copy;
-   thus, the "to_chars" function returns the number of bytes copied or
-   XTENSA_UNDEFINED on error.  The "from_chars" function first reads the
-   minimal number of bytes required to decode the instruction length and
-   then proceeds to copy the entire instruction into the buffer; if the
-   memory does not contain a valid instruction, it copies the maximum
-   number of bytes required for the longest Xtensa instruction.  The
-   "num_chars" argument may be used to limit the number of bytes that
-   can be read or written.  Otherwise, if "num_chars" is zero, the
-   functions may read or write past the end of the code.  */
-
-extern int
-xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn,
-			 char *cp, int num_chars);
-
-extern void
-xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn,
-			   const char *cp, int num_chars);
-
-
 /* ISA information.  */
 
-/* Initialize the ISA information.  */
+/* Load the ISA information from a shared library.  If successful, this returns
+   a value which identifies the ISA for use in subsequent calls to the ISA
+   library; otherwise, it returns NULL.  Multiple ISAs can be loaded to support
+   heterogeneous multiprocessor systems.  */
+extern xtensa_isa xtensa_load_isa (libisa_module_specifier);
 
-extern xtensa_isa
-xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p);
+/* Extend an existing set of ISA information by loading an additional shared
+   library of ISA information.  This is primarily intended for loading TIE
+   extensions.  If successful, the return value is non-zero.  */
+extern int xtensa_extend_isa (xtensa_isa, libisa_module_specifier);
+
+/* The default ISA.  This variable is set automatically to the ISA most
+   recently loaded and is provided as a convenience.  An exception is the GNU
+   opcodes library, where there is a fixed interface that does not allow
+   passing the ISA as a parameter and the ISA must be taken from this global
+   variable.  (Note: Since this variable is just a convenience, it is not
+   exported when libisa is built as a DLL, due to the hassle of dealing with
+   declspecs.)  */
+extern xtensa_isa xtensa_default_isa;
 
 
 /* Deallocate an xtensa_isa structure.  */
-
-extern void
-xtensa_isa_free (xtensa_isa isa);
-
+extern void xtensa_isa_free (xtensa_isa);
 
 /* Get the maximum instruction size in bytes.  */
+extern int xtensa_insn_maxlength (xtensa_isa); 
 
-extern int
-xtensa_isa_maxlength (xtensa_isa isa); 
-
-
-/* Decode the length in bytes of an instruction in raw memory (not an
-   insnbuf).  This function reads only the minimal number of bytes
-   required to decode the instruction length.  Returns
-   XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_isa_length_from_chars (xtensa_isa isa, const char *cp);
-
-
-/* Get the number of stages in the processor's pipeline.  The pipeline
-   stage values returned by other functions in this library will range
-   from 0 to N-1, where N is the value returned by this function.
-   Note that the stage numbers used here may not correspond to the
-   actual processor hardware, e.g., the hardware may have additional
-   stages before stage 0.  Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_isa_num_pipe_stages (xtensa_isa isa); 
-
-
-/* Get the number of various entities that are defined for this processor.  */
-
-extern int
-xtensa_isa_num_formats (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_opcodes (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_regfiles (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_states (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_sysregs (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_interfaces (xtensa_isa isa);
-
-extern int
-xtensa_isa_num_funcUnits (xtensa_isa isa);
-
-
-/* Instruction formats.  */
-
-/* Get the name of a format.  Returns null on error.  */
-
-extern const char *
-xtensa_format_name (xtensa_isa isa, xtensa_format fmt);
-
-
-/* Given a format name, return the format number.  Returns
-   XTENSA_UNDEFINED if the name is not a valid format.  */
-
-extern xtensa_format
-xtensa_format_lookup (xtensa_isa isa, const char *fmtname);
-
-
-/* Decode the instruction format from a binary instruction buffer.
-   Returns XTENSA_UNDEFINED if the format is not recognized.  */
-
-extern xtensa_format
-xtensa_format_decode (xtensa_isa isa, const xtensa_insnbuf insn);
-
-
-/* Set the instruction format field(s) in a binary instruction buffer.
-   All the other fields are set to zero.  Returns non-zero on error.  */
-
-extern int
-xtensa_format_encode (xtensa_isa isa, xtensa_format fmt, xtensa_insnbuf insn);
-
-
-/* Find the length (in bytes) of an instruction.  Returns
-   XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_format_length (xtensa_isa isa, xtensa_format fmt);
-
-
-/* Get the number of slots in an instruction.  Returns XTENSA_UNDEFINED
-   on error.  */
-
-extern int
-xtensa_format_num_slots (xtensa_isa isa, xtensa_format fmt);
-
-
-/* Get the opcode for a no-op in a particular slot.
-   Returns XTENSA_UNDEFINED on error.  */
-
-extern xtensa_opcode
-xtensa_format_slot_nop_opcode (xtensa_isa isa, xtensa_format fmt, int slot);
-
-
-/* Get the bits for a specified slot out of an insnbuf for the
-   instruction as a whole and put them into an insnbuf for that one
-   slot, and do the opposite to set a slot.  Return non-zero on error.  */
-
-extern int
-xtensa_format_get_slot (xtensa_isa isa, xtensa_format fmt, int slot,
-			const xtensa_insnbuf insn, xtensa_insnbuf slotbuf);
-
-extern int
-xtensa_format_set_slot (xtensa_isa isa, xtensa_format fmt, int slot,
-			xtensa_insnbuf insn, const xtensa_insnbuf slotbuf);
-
-
-/* Opcode information.  */
+/* Get the total number of opcodes for this processor.  */
+extern int xtensa_num_opcodes (xtensa_isa);
 
 /* Translate a mnemonic name to an opcode.  Returns XTENSA_UNDEFINED if
    the name is not a valid opcode mnemonic.  */
+extern xtensa_opcode xtensa_opcode_lookup (xtensa_isa, const char *);
 
-extern xtensa_opcode
-xtensa_opcode_lookup (xtensa_isa isa, const char *opname);
+/* Decode a binary instruction buffer.  Returns the opcode or
+   XTENSA_UNDEFINED if the instruction is illegal.  */
+extern xtensa_opcode xtensa_decode_insn (xtensa_isa, const xtensa_insnbuf);
 
 
-/* Decode the opcode for one instruction slot from a binary instruction
-   buffer.  Returns the opcode or XTENSA_UNDEFINED if the opcode is
-   illegal.  */
+/* Opcode information.  */
 
-extern xtensa_opcode
-xtensa_opcode_decode (xtensa_isa isa, xtensa_format fmt, int slot,
-		      const xtensa_insnbuf slotbuf);
+/* Set the opcode field(s) in a binary instruction buffer.  The operand
+   fields are set to zero.  */
+extern void xtensa_encode_insn (xtensa_isa, xtensa_opcode, xtensa_insnbuf);
 
+/* Get the mnemonic name for an opcode.  */
+extern const char * xtensa_opcode_name (xtensa_isa, xtensa_opcode);
 
-/* Set the opcode field(s) for an instruction slot.  All other fields
-   in the slot are set to zero.  Returns non-zero if the opcode cannot
-   be encoded.  */
+/* Find the length (in bytes) of an instruction.  */
+extern int xtensa_insn_length (xtensa_isa, xtensa_opcode);
 
-extern int
-xtensa_opcode_encode (xtensa_isa isa, xtensa_format fmt, int slot,
-		      xtensa_insnbuf slotbuf, xtensa_opcode opc);
+/* Find the length of an instruction by looking only at the first byte.  */
+extern int xtensa_insn_length_from_first_byte (xtensa_isa, char);
 
+/* Find the number of operands for an instruction.  */
+extern int xtensa_num_operands (xtensa_isa, xtensa_opcode);
 
-/* Get the mnemonic name for an opcode.  Returns null on error.  */
+/* Get the information about operand number "opnd" of a particular opcode.  */
+extern xtensa_operand xtensa_get_operand (xtensa_isa, xtensa_opcode, int);
 
-extern const char *
-xtensa_opcode_name (xtensa_isa isa, xtensa_opcode opc);
-
-
-/* Check various properties of opcodes.  These functions return 0 if
-   the condition is false, 1 if the condition is true, and
-   XTENSA_UNDEFINED on error.  The instructions are classified as
-   follows:
-
-   branch: conditional branch; may fall through to next instruction (B*)
-   jump: unconditional branch (J, JX, RET*, RF*)
-   loop: zero-overhead loop (LOOP*)
-   call: unconditional call; control returns to next instruction (CALL*)
-
-   For the opcodes that affect control flow in some way, the branch
-   target may be specified by an immediate operand or it may be an
-   address stored in a register.  You can distinguish these by
-   checking if the instruction has a PC-relative immediate
-   operand.  */
-
-extern int
-xtensa_opcode_is_branch (xtensa_isa isa, xtensa_opcode opc);
-
-extern int
-xtensa_opcode_is_jump (xtensa_isa isa, xtensa_opcode opc);
-
-extern int
-xtensa_opcode_is_loop (xtensa_isa isa, xtensa_opcode opc);
-
-extern int
-xtensa_opcode_is_call (xtensa_isa isa, xtensa_opcode opc);
-
-
-/* Find the number of ordinary operands, state operands, and interface
-   operands for an instruction.  These return XTENSA_UNDEFINED on
-   error.  */
-
-extern int
-xtensa_opcode_num_operands (xtensa_isa isa, xtensa_opcode opc);
-
-
-extern int
-xtensa_opcode_num_stateOperands (xtensa_isa isa, xtensa_opcode opc);
-
-extern int
-xtensa_opcode_num_interfaceOperands (xtensa_isa isa, xtensa_opcode opc);
-
-
-/* Get functional unit usage requirements for an opcode.  Each "use"
-   is identified by a <functional unit, pipeline stage> pair.  The
-   "num_funcUnit_uses" function returns the number of these "uses" or
-   XTENSA_UNDEFINED on error.  The "funcUnit_use" function returns
-   a pointer to a "use" pair or null on error.  */
-
-typedef struct xtensa_funcUnit_use_struct
-{
-  xtensa_funcUnit unit;
-  int stage;
-} xtensa_funcUnit_use;
-
-extern int
-xtensa_opcode_num_funcUnit_uses (xtensa_isa isa, xtensa_opcode opc);
-
-extern xtensa_funcUnit_use *
-xtensa_opcode_funcUnit_use (xtensa_isa isa, xtensa_opcode opc, int u);
-
-
 /* Operand information.  */
 
-/* Get the name of an operand.  Returns null on error.  */
+/* Find the kind of operand.  There are three possibilities:
+   1) PC-relative immediates (e.g., "l", "L").  These can be identified with
+      the xtensa_operand_isPCRelative function.
+   2) non-PC-relative immediates ("i").
+   3) register-file short names (e.g., "a", "b", "m" and others defined
+      via TIE).  */
+extern char * xtensa_operand_kind (xtensa_operand);
 
-extern const char *
-xtensa_operand_name (xtensa_isa isa, xtensa_opcode opc, int opnd);
-
-
-/* Some operands are "invisible", i.e., not explicitly specified in
-   assembly language.  When assembling an instruction, you need not set
-   the values of invisible operands, since they are either hardwired or
-   derived from other field values.  The values of invisible operands
-   can be examined in the same way as other operands, but remember that
-   an invisible operand may get its value from another visible one, so
-   the entire instruction must be available before examining the
-   invisible operand values.  This function returns 1 if an operand is
-   visible, 0 if it is invisible, or XTENSA_UNDEFINED on error.  Note
-   that whether an operand is visible is orthogonal to whether it is
-   "implicit", i.e., whether it is encoded in a field in the
-   instruction.  */
-
-extern int
-xtensa_operand_is_visible (xtensa_isa isa, xtensa_opcode opc, int opnd);
-
-
-/* Check if an operand is an input ('i'), output ('o'), or inout ('m')
+/* Check if an operand is an input ('<'), output ('>'), or inout ('=')
    operand.  Note: The output operand of a conditional assignment
-   (e.g., movnez) appears here as an inout ('m') even if it is declared
-   in the TIE code as an output ('o'); this allows the compiler to
-   properly handle register allocation for conditional assignments.
-   Returns 0 on error.  */
-
-extern char
-xtensa_operand_inout (xtensa_isa isa, xtensa_opcode opc, int opnd);
-
+   (e.g., movnez) appears here as an inout ('=') even if it is declared
+   in the TIE code as an output ('>'); this allows the compiler to
+   properly handle register allocation for conditional assignments.  */
+extern char xtensa_operand_inout (xtensa_operand);
 
 /* Get and set the raw (encoded) value of the field for the specified
    operand.  The "set" function does not check if the value fits in the
-   field; that is done by the "encode" function below.  Both of these
-   functions return non-zero on error, e.g., if the field is not defined
-   for the specified slot.  */
+   field; that is done by the "encode" function below.  */
+extern uint32 xtensa_operand_get_field (xtensa_operand, const xtensa_insnbuf);
 
-extern int
-xtensa_operand_get_field (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			  xtensa_format fmt, int slot,
-			  const xtensa_insnbuf slotbuf, uint32 *valp);
+extern void xtensa_operand_set_field (xtensa_operand, xtensa_insnbuf, uint32);
 
-extern int 
-xtensa_operand_set_field (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			  xtensa_format fmt, int slot,
-			  xtensa_insnbuf slotbuf, uint32 val);
 
+/* Encode and decode operands.  The raw bits in the operand field
+   may be encoded in a variety of different ways.  These functions hide the
+   details of that encoding.  The encode function has a special return type
+   (xtensa_encode_result) to indicate success or the reason for failure; the
+   encoded value is returned through the argument pointer.  The decode function
+   has no possibility of failure and returns the decoded value.  */
 
-/* Encode and decode operands.  The raw bits in the operand field may
-   be encoded in a variety of different ways.  These functions hide
-   the details of that encoding.  The result values are returned through
-   the argument pointer.  The return value is non-zero on error.  */
+typedef enum
+{
+  xtensa_encode_result_ok,
+  xtensa_encode_result_align,
+  xtensa_encode_result_not_in_table,
+  xtensa_encode_result_too_low,
+  xtensa_encode_result_too_high,
+  xtensa_encode_result_not_ok,
+  xtensa_encode_result_max = xtensa_encode_result_not_ok
+} xtensa_encode_result;
 
-extern int
-xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
-		       uint32 *valp);
+extern xtensa_encode_result xtensa_operand_encode (xtensa_operand, uint32 *);
 
-extern int
-xtensa_operand_decode (xtensa_isa isa, xtensa_opcode opc, int opnd,
-		       uint32 *valp);
+extern uint32 xtensa_operand_decode (xtensa_operand, uint32);
 
 
-/* An operand may be either a register operand or an immediate of some
-   sort (e.g., PC-relative or not).  The "is_register" function returns
-   0 if the operand is an immediate, 1 if it is a register, and
-   XTENSA_UNDEFINED on error.  The "regfile" function returns the
-   regfile for a register operand, or XTENSA_UNDEFINED on error.  */
+/* For PC-relative offset operands, the interpretation of the offset may vary
+   between opcodes, e.g., is it relative to the current PC or that of the next
+   instruction?  The following functions are defined to perform PC-relative
+   relocations and to undo them (as in the disassembler).  The first function
+   takes the desired address and the PC of the current instruction and returns
+   the unencoded value to be stored in the offset field.  The second function
+   takes the unencoded offset value and the current PC and returns the address.
+   Note that these functions do not replace the encode/decode functions; the
+   operands must be encoded/decoded separately.  */
 
-extern int
-xtensa_operand_is_register (xtensa_isa isa, xtensa_opcode opc, int opnd);
+extern int xtensa_operand_isPCRelative (xtensa_operand);
 
-extern xtensa_regfile
-xtensa_operand_regfile (xtensa_isa isa, xtensa_opcode opc, int opnd);
+extern uint32 xtensa_operand_do_reloc (xtensa_operand, uint32, uint32);
 
-
-/* Register operands may span multiple consecutive registers, e.g., a
-   64-bit data type may occupy two 32-bit registers.  Only the first
-   register is encoded in the operand field.  This function specifies
-   the number of consecutive registers occupied by this operand.  For
-   non-register operands, the return value is undefined.  Returns
-   XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_operand_num_regs (xtensa_isa isa, xtensa_opcode opc, int opnd);
-				 
-
-/* Some register operands do not completely identify the register being
-   accessed.  For example, the operand value may be added to an internal
-   state value.  By definition, this implies that the corresponding
-   regfile is not allocatable.  Unknown registers should generally be
-   treated with worst-case assumptions.  The function returns 0 if the
-   register value is unknown, 1 if known, and XTENSA_UNDEFINED on
-   error.  */
-
-extern int
-xtensa_operand_is_known_reg (xtensa_isa isa, xtensa_opcode opc, int opnd);
-
-
-/* Check if an immediate operand is PC-relative.  Returns 0 for register
-   operands and non-PC-relative immediates, 1 for PC-relative
-   immediates, and XTENSA_UNDEFINED on error.  */
- 
-extern int
-xtensa_operand_is_PCrelative (xtensa_isa isa, xtensa_opcode opc, int opnd);
-
-
-/* For PC-relative offset operands, the interpretation of the offset may
-   vary between opcodes, e.g., is it relative to the current PC or that
-   of the next instruction?  The following functions are defined to
-   perform PC-relative relocations and to undo them (as in the
-   disassembler).  The "do_reloc" function takes the desired address
-   value and the PC of the current instruction and sets the value to the
-   corresponding PC-relative offset (which can then be encoded and
-   stored into the operand field).  The "undo_reloc" function takes the
-   unencoded offset value and the current PC and sets the value to the
-   appropriate address.  The return values are non-zero on error.  Note
-   that these functions do not replace the encode/decode functions; the
-   operands must be encoded/decoded separately and the encode functions
-   are responsible for detecting invalid operand values.  */
-
-extern int
-xtensa_operand_do_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			 uint32 *valp, uint32 pc);
-
-extern int
-xtensa_operand_undo_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd,
-			   uint32 *valp, uint32 pc);
-
-
-/* State Operands.  */
-
-/* Get the state accessed by a state operand.  Returns XTENSA_UNDEFINED
-   on error.  */
-
-extern xtensa_state
-xtensa_stateOperand_state (xtensa_isa isa, xtensa_opcode opc, int stOp);
-
-
-/* Check if a state operand is an input ('i'), output ('o'), or inout
-   ('m') operand.  Returns 0 on error.  */
-
-extern char
-xtensa_stateOperand_inout (xtensa_isa isa, xtensa_opcode opc, int stOp);
-
-
-/* Interface Operands.  */
-
-/* Get the external interface accessed by an interface operand.
-   Returns XTENSA_UNDEFINED on error.  */
-
-extern xtensa_interface
-xtensa_interfaceOperand_interface (xtensa_isa isa, xtensa_opcode opc,
-				   int ifOp);
-
-
-/* Register Files.  */
-
-/* Regfiles include both "real" regfiles and "views", where a view
-   allows a group of adjacent registers in a real "parent" regfile to be
-   viewed as a single register.  A regfile view has all the same
-   properties as its parent except for its (long) name, bit width, number
-   of entries, and default ctype.  You can use the parent function to
-   distinguish these two classes.  */
-
-/* Look up a regfile by either its name or its abbreviated "short name".
-   Returns XTENSA_UNDEFINED on error.  The "lookup_shortname" function
-   ignores "view" regfiles since they always have the same shortname as
-   their parents.  */
-
-extern xtensa_regfile
-xtensa_regfile_lookup (xtensa_isa isa, const char *name);
-
-extern xtensa_regfile
-xtensa_regfile_lookup_shortname (xtensa_isa isa, const char *shortname);
-
-
-/* Get the name or abbreviated "short name" of a regfile.
-   Returns null on error.  */
-
-extern const char *
-xtensa_regfile_name (xtensa_isa isa, xtensa_regfile rf);
-
-extern const char *
-xtensa_regfile_shortname (xtensa_isa isa, xtensa_regfile rf);
-
-
-/* Get the parent regfile of a "view" regfile.  If the regfile is not a
-   view, the result is the same as the input parameter.  Returns
-   XTENSA_UNDEFINED on error.  */
-
-extern xtensa_regfile
-xtensa_regfile_view_parent (xtensa_isa isa, xtensa_regfile rf);
-
-
-/* Get the bit width of a regfile or regfile view.
-   Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_regfile_num_bits (xtensa_isa isa, xtensa_regfile rf);
-
-
-/* Get the number of regfile entries.  Returns XTENSA_UNDEFINED on
-   error.  */
-
-extern int
-xtensa_regfile_num_entries (xtensa_isa isa, xtensa_regfile rf);
-
-
-/* Processor States.  */
-
-/* Look up a state by name.  Returns XTENSA_UNDEFINED on error.  */
-
-extern xtensa_state
-xtensa_state_lookup (xtensa_isa isa, const char *name);
-
-
-/* Get the name for a processor state.  Returns null on error.  */
-
-extern const char *
-xtensa_state_name (xtensa_isa isa, xtensa_state st);
-
-
-/* Get the bit width for a processor state.
-   Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_state_num_bits (xtensa_isa isa, xtensa_state st);
-
-
-/* Check if a state is exported from the processor core.  Returns 0 if
-   the condition is false, 1 if the condition is true, and
-   XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_state_is_exported (xtensa_isa isa, xtensa_state st);
-
-
-/* Sysregs ("special registers" and "user registers").  */
-
-/* Look up a register by its number and whether it is a "user register"
-   or a "special register".  Returns XTENSA_UNDEFINED if the sysreg does
-   not exist.  */
-
-extern xtensa_sysreg
-xtensa_sysreg_lookup (xtensa_isa isa, int num, int is_user);
-
-
-/* Check if there exists a sysreg with a given name.
-   If not, this function returns XTENSA_UNDEFINED.  */
-
-extern xtensa_sysreg
-xtensa_sysreg_lookup_name (xtensa_isa isa, const char *name);
-
-
-/* Get the name of a sysreg.  Returns null on error.  */
-
-extern const char *
-xtensa_sysreg_name (xtensa_isa isa, xtensa_sysreg sysreg);
-
-
-/* Get the register number.  Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_sysreg_number (xtensa_isa isa, xtensa_sysreg sysreg);
-
-
-/* Check if a sysreg is a "special register" or a "user register".
-   Returns 0 for special registers, 1 for user registers and
-   XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_sysreg_is_user (xtensa_isa isa, xtensa_sysreg sysreg);
-
-
-/* Interfaces.  */
-
-/* Find an interface by name.  The return value is XTENSA_UNDEFINED if
-   the specified interface is not found.  */
-
-extern xtensa_interface
-xtensa_interface_lookup (xtensa_isa isa, const char *ifname);
-
-
-/* Get the name of an interface.  Returns null on error.  */
-
-extern const char *
-xtensa_interface_name (xtensa_isa isa, xtensa_interface intf);
-
-
-/* Get the bit width for an interface.
-   Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_interface_num_bits (xtensa_isa isa, xtensa_interface intf);
-
-
-/* Check if an interface is an input ('i') or output ('o') with respect
-   to the Xtensa processor core.  Returns 0 on error.  */
-
-extern char
-xtensa_interface_inout (xtensa_isa isa, xtensa_interface intf);
-
-
-/* Check if accessing an interface has potential side effects.
-   Currently "data" interfaces have side effects and "control"
-   interfaces do not.  Returns 1 if there are side effects, 0 if not,
-   and XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_interface_has_side_effect (xtensa_isa isa, xtensa_interface intf);
-
-
-/* Functional Units.  */
-
-/* Find a functional unit by name.  The return value is XTENSA_UNDEFINED if
-   the specified unit is not found.  */
-
-extern xtensa_funcUnit
-xtensa_funcUnit_lookup (xtensa_isa isa, const char *fname);
-
-
-/* Get the name of a functional unit.  Returns null on error.  */
-
-extern const char *
-xtensa_funcUnit_name (xtensa_isa isa, xtensa_funcUnit fun);
-
-
-/* Functional units may be replicated.  See how many instances of a
-   particular function unit exist.  Returns XTENSA_UNDEFINED on error.  */
-
-extern int
-xtensa_funcUnit_num_copies (xtensa_isa isa, xtensa_funcUnit fun);
-
+extern uint32 xtensa_operand_undo_reloc	(xtensa_operand, uint32, uint32);
 
 #ifdef __cplusplus
 }
diff --git a/install-sh b/install-sh
index dd97db7..77bc381 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2004-09-10.20
+scriptversion=2004-02-15.20
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -58,6 +58,9 @@
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
+transformbasename=
+transform_arg=
+instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
 chowncmd=
 chgrpcmd=
@@ -67,27 +70,23 @@
 src=
 dst=
 dir_arg=
-dstarg=
-no_target_directory=
 
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
+   or: $0 -d DIRECTORIES...
 
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
+In the second, create the directory path DIR.
 
 Options:
--c         (ignored)
+-b=TRANSFORMBASENAME
+-c         copy source (using $cpprog) instead of moving (using $mvprog).
 -d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
+-g GROUP   $chgrp installed files to GROUP.
+-m MODE    $chmod installed files to MODE.
+-o USER    $chown installed files to USER.
+-s         strip installed files (using $stripprog).
+-t=TRANSFORM
 --help     display this help and exit.
 --version  display version info and exit.
 
@@ -97,7 +96,12 @@
 
 while test -n "$1"; do
   case $1 in
-    -c) shift
+    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+        shift
+        continue;;
+
+    -c) instcmd=$cpprog
+        shift
         continue;;
 
     -d) dir_arg=true
@@ -125,20 +129,14 @@
         shift
         continue;;
 
-    -t) dstarg=$2
-	shift
-	shift
-	continue;;
-
-    -T) no_target_directory=true
-	shift
-	continue;;
+    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+        shift
+        continue;;
 
     --version) echo "$0 $scriptversion"; exit 0;;
 
     *)  # When -d is used, all remaining arguments are directories to create.
-	# When -t is used, the destination is already specified.
-	test -n "$dir_arg$dstarg" && break
+	test -n "$dir_arg" && break
         # Otherwise, the last argument is the destination.  Remove it from $@.
 	for arg
 	do
@@ -176,13 +174,13 @@
     src=
 
     if test -d "$dst"; then
-      mkdircmd=:
+      instcmd=:
       chmodcmd=
     else
-      mkdircmd=$mkdirprog
+      instcmd=$mkdirprog
     fi
   else
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
     if test ! -f "$src" && test ! -d "$src"; then
@@ -204,10 +202,6 @@
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dstarg: Is a directory" >&2
-	exit 1
-      fi
       dst=$dst/`basename "$src"`
     fi
   fi
@@ -235,77 +229,77 @@
       pathcomp=$pathcomp$1
       shift
       if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp"
+        $mkdirprog "$pathcomp" || lasterr=$?
 	# mkdir can fail with a `File exist' error in case several
 	# install-sh are creating the directory concurrently.  This
 	# is OK.
-	test -d "$pathcomp" || exit
+	test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
       fi
       pathcomp=$pathcomp/
     done
   fi
 
   if test -n "$dir_arg"; then
-    $doit $mkdircmd "$dst" \
+    $doit $instcmd "$dst" \
       && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
       && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
 
   else
-    dstfile=`basename "$dst"`
+    # If we're going to rename the final executable, determine the name now.
+    if test -z "$transformarg"; then
+      dstfile=`basename "$dst"`
+    else
+      dstfile=`basename "$dst" $transformbasename \
+               | sed $transformarg`$transformbasename
+    fi
+
+    # don't allow the sed command to completely eliminate the filename.
+    test -z "$dstfile" && dstfile=`basename "$dst"`
 
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
     rmtmp=$dstdir/_rm.$$_
 
     # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
     trap '(exit $?); exit' 1 2 13 15
 
-    # Copy the file name to the temp name.
-    $doit $cpprog "$src" "$dsttmp" &&
+    # Move or copy the file name to the temp name
+    $doit $instcmd "$src" "$dsttmp" &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
     # If any of these fail, we abort the whole thing.  If we want to
     # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    # errors from the above "$doit $instcmd $src $dsttmp" command.
     #
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
       && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
 
+    # Now remove or move aside any old file at destination location.  We
+    # try this two ways since rm can't unlink itself on some systems and
+    # the destination file might be busy for other reasons.  In this case,
+    # the final cleanup might fail but the new file should still install
+    # successfully.
+    {
+      if test -f "$dstdir/$dstfile"; then
+        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+        || {
+	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+	  (exit 1); exit
+        }
+      else
+        :
+      fi
+    } &&
+
     # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
-      || {
-	   # The rename failed, perhaps because mv can't rename something else
-	   # to itself, or perhaps because mv is so ancient that it does not
-	   # support -f.
-
-	   # Now remove or move aside any old file at destination location.
-	   # We try this two ways since rm can't unlink itself on some
-	   # systems and the destination file might be busy for other
-	   # reasons.  In this case, the final cleanup might fail but the new
-	   # file should still install successfully.
-	   {
-	     if test -f "$dstdir/$dstfile"; then
-	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
-	       || {
-		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-		 (exit 1); exit
-	       }
-	     else
-	       :
-	     fi
-	   } &&
-
-	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-	 }
-    }
+    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
   fi || { (exit 1); exit; }
 done
 
diff --git a/intl/ChangeLog b/intl/ChangeLog
new file mode 100644
index 0000000..44d88e4
--- /dev/null
+++ b/intl/ChangeLog
@@ -0,0 +1,1091 @@
+2002-01-21  Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
+
+	* linux-msg.sed: Comment typo fix.
+	* xopen-msg.sed: Likewise.
+
+1998-04-29  Ulrich Drepper  <drepper@cygnus.com>
+
+	* intl/localealias.c (read_alias_file): Use unsigned char for
+	local variables.  Remove unused variable tp.
+	* intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
+	for type of codeset.  For loosing Solaris systems.
+	* intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset.
+	* intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable
+	len if not needed.
+	Patches by Jim Meyering.
+
+1998-04-28  Ulrich Drepper  <drepper@cygnus.com>
+
+	* loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if
+	mmap is not supported.
+
+	* hash-string.h: Don't include <values.h>.
+
+1998-04-27  Ulrich Drepper  <drepper@cygnus.com>
+
+	* textdomain.c: Use strdup is available.
+
+	* localealias.c: Define HAVE_MEMPCPY so that we can use this
+	function.  Define and use semapahores to protect modfication of
+	global objects when compiling for glibc.  Add code to allow
+	freeing alias table.
+
+	* l10nflist.c: Don't assume stpcpy not being a macro.
+
+	* gettextP.h: Define internal_function macri if not already done.
+	Use glibc byte-swap macros instead of defining SWAP when compiled
+	for glibc.
+	(struct loaded_domain): Add elements to allow unloading.
+
+	* Makefile.in (distclean): Don't remove libintl.h here.
+
+	* bindtextdomain.c: Carry over changes from glibc.  Use strdup if
+	available.
+
+	* dcgettext.c: Don't assume stpcpy not being a macro.  Mark internal
+	functions.  Add memory freeing code for glibc.
+
+	* dgettext.c: Update copyright.
+
+	* explodename.c: Include stdlib.h and string.h only if they exist.
+	Use strings.h eventually.
+
+	* finddomain.c: Mark internal functions.  Use strdup if available.
+	Add memory freeing code for glibc.
+
+1997-10-10 20:00  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libgettext.h: Fix dummy textdomain and bindtextdomain macros.
+	They should return reasonable values.
+	Reported by Tom Tromey <tromey@cygnus.com>.
+
+1997-09-16 03:33  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libgettext.h: Define PARAMS also to `args' if __cplusplus is defined.
+	* intlh.inst.in: Likewise.
+	Reported by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>.
+
+	* libintl.glibc: Update from current glibc version.
+
+1997-09-06 02:10  Ulrich Drepper  <drepper@cygnus.com>
+
+	* intlh.inst.in: Reformat copyright.
+
+1997-08-19 15:22  Ulrich Drepper  <drepper@cygnus.com>
+
+	* dcgettext.c (DCGETTEXT): Remove wrong comment.
+
+1997-08-16 00:13  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (install-data): Don't change directory to install.
+
+1997-08-01 14:30  Ulrich Drepper  <drepper@cygnus.com>
+
+	* cat-compat.c: Fix copyright.
+
+	* localealias.c: Don't define strchr unless !HAVE_STRCHR.
+
+	* loadmsgcat.c: Update copyright.  Fix typos.
+
+	* l10nflist.c: Don't define strchr unless !HAVE_STRCHR.
+	(_nl_make_l10nflist): Handle sponsor and revision correctly.
+
+	* gettext.c: Update copyright.
+	* gettext.h: Likewise.
+	* hash-string.h: Likewise.
+
+	* finddomain.c: Remoave dead code.  Define strchr only if
+	!HAVE_STRCHR.
+
+	* explodename.c: Include <sys/types.h>.
+
+	* explodename.c: Reformat copyright text.
+	(_nl_explode_name): Fix typo.
+
+	* dcgettext.c: Define and use __set_errno.
+	(guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is
+	not defined.
+
+	* bindtextdom.c: Pretty printing.
+
+1997-05-01 02:25  Ulrich Drepper  <drepper@cygnus.com>
+
+	* dcgettext.c (guess_category_value): Don't depend on
+	HAVE_LC_MESSAGES.  We don't need the macro here.
+	Patch by Bruno Haible <haible@ilog.fr>.
+
+	* cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL
+	macro.  Instead use HAVE_LOCALE_NULL and define it when using
+	glibc, as in dcgettext.c.
+	Patch by Bruno Haible <haible@ilog.fr>.
+
+	* Makefile.in (CPPFLAGS): New variable.  Reported by Franc,ois
+	Pinard.
+
+Mon Mar 10 06:51:17 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in: Implement handling of libtool.
+
+	* gettextP.h: Change data structures for use of generic lowlevel
+	i18n file handling.
+
+Wed Dec  4 20:21:18 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* textdomain.c: Put parentheses around arguments of memcpy macro
+	definition.
+	* localealias.c: Likewise.
+	* l10nflist.c: Likewise.
+	* finddomain.c: Likewise.
+	* bindtextdom.c: Likewise.
+	Reported by Thomas Esken.
+
+Mon Nov 25 22:57:51 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* textdomain.c: Move definition of `memcpy` macro to right
+	position.
+
+Fri Nov 22 04:01:58 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using
+ 	bcopy if not already defined.  Reported by Thomas Esken.
+	* bindtextdom.c: Likewise.
+	* l10nflist.c: Likewise.
+	* localealias.c: Likewise.
+	* textdomain.c: Likewise.
+
+Tue Oct 29 11:10:27 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (libdir): Change to use exec_prefix instead of
+ 	prefix.  Reported by Knut-HåvardAksnes <etokna@eto.ericsson.se>.
+
+Sat Aug 31 03:07:09 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* l10nflist.c (_nl_normalize_codeset): We convert to lower case,
+	so don't prepend uppercase `ISO' for only numeric arg.
+
+Fri Jul 19 00:15:46 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after
+	definition of _GNU_SOURCE.  Patch by Roland McGrath.
+
+	* Makefile.in (uninstall): Fix another bug with `for' loop and
+	empty arguments.  Patch by Jim Meyering.  Correct name os
+	uninstalled files: no intl- prefix anymore.
+
+	* Makefile.in (install-data): Again work around shells which
+	cannot handle mpty for list.  Reported by Jim Meyering.
+
+Sat Jul 13 18:11:35 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (install): Split goal.  Now depend on install-exec
+        and install-data.
+	(install-exec, install-data): New goals.  Created from former
+	install goal.
+	Reported by Karl Berry.
+
+Sat Jun 22 04:58:14 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (MKINSTALLDIRS): New variable.  Path to
+        mkinstalldirs script.
+	(install): use MKINSTALLDIRS variable or if the script is not present
+	try to find it in the $top_scrdir).
+
+Wed Jun 19 02:56:56 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* l10nflist.c: Linux libc *partly* includes the argz_* functions.
+	Grr.  Work around by renaming the static version and use macros
+	for renaming.
+
+Tue Jun 18 20:11:17 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* l10nflist.c: Correct presence test macros of __argz_* functions.
+
+	* l10nflist.c: Include <argz.h> based on test of it instead when
+	__argz_* functions are available.
+	Reported by Andreas Schwab.
+
+Thu Jun 13 15:17:44 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* explodename.c, l10nflist.c: Define NULL for dumb systems.
+
+Tue Jun 11 17:05:13 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* intlh.inst.in, libgettext.h (dcgettext): Rename local variable
+	result to __result to prevent name clash.
+
+	* l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to
+        get prototype for stpcpy and strcasecmp.
+
+	* intlh.inst.in, libgettext.h: Move declaration of
+	`_nl_msg_cat_cntr' outside __extension__ block to prevent warning
+	from gcc's -Wnested-extern option.
+
+Fri Jun  7 01:58:00 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (install): Remove comment.
+
+Thu Jun  6 17:28:17 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (install): Work around for another Buglix stupidity.
+	Always use an `else' close for `if's.  Reported by Nelson Beebe.
+
+	* Makefile.in (intlh.inst): Correct typo in phony rule.
+	Reported by Nelson Beebe.
+
+Thu Jun  6 01:49:52 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* dcgettext.c (read_alias_file): Rename variable alloca_list to
+	block_list as the macro calls assume.
+	Patch by Eric Backus.
+
+	* localealias.c [!HAVE_ALLOCA]: Define alloca as macro using
+        malloc.
+	(read_alias_file): Rename varriabe alloca_list to block_list as the
+	macro calls assume.
+	Patch by Eric Backus.
+
+	* l10nflist.c: Correct conditional for <argz.h> inclusion.
+	Reported by Roland McGrath.
+
+	* Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not
+        all-@USE_NLS@.
+
+	* Makefile.in (install): intlh.inst comes from local dir, not
+        $(srcdir).
+
+	* Makefile.in (intlh.inst): Special handling of this goal.  If
+	used in gettext, this is really a rul to construct this file.  If
+	used in any other package it is defined as a .PHONY rule with
+	empty body.
+
+	* finddomain.c: Extract locale file information handling into
+	l10nfile.c.  Rename local stpcpy__ function to stpcpy.
+
+	* dcgettext.c (stpcpy): Add local definition.
+
+	* l10nflist.c: Solve some portability problems.  Patches partly by
+	Thomas Esken.  Add local definition of stpcpy.
+
+Tue Jun  4 02:47:49 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* intlh.inst.in: Don't depend including <locale.h> on
+	HAVE_LOCALE_H.  Instead configure must rewrite this fiile
+	depending on the result of the configure run.
+
+	* Makefile.in (install): libintl.inst is now called intlh.inst.
+	Add rules for updating intlh.inst from intlh.inst.in.
+
+	* libintl.inst: Renamed to intlh.inst.in.
+
+	* localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1
+        because gcc has __buitlin_alloca.
+	Reported by Roland McGrath.
+
+Mon Jun  3 00:32:16 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile.in (installcheck): New goal to fulfill needs of
+        automake's distcheck.
+
+	* Makefile.in (install): Reorder commands so that VERSION is
+        found.
+
+	* Makefile.in (gettextsrcdir): Now use subdirectory intl/ in
+        @datadir@/gettext.
+	(COMSRCS): Add l10nfile.c.
+	(OBJECTS): Add l10nfile.o.
+	(DISTFILES): Rename to DISTFILE.normal.  Remove $(DISTFILES.common).
+	(DISTFILE.gettext): Remove $(DISTFILES.common).
+	(all-gettext): Remove goal.
+	(install): If $(PACKAGE) = gettext install, otherwose do nothing.  No
+	package but gettext itself should install libintl.h + headers.
+	(dist): Extend goal to work for gettext, too.
+	(dist-gettext): Remove goal.
+
+	* dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc.
+
+Sun Jun  2 17:33:06 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* loadmsgcat.c (_nl_load_domain): Parameter is now comes from
+        find_l10nfile.
+
+Sat Jun  1 02:23:03 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* l10nflist.c (__argz_next): Add definition.
+
+	* dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca
+	code.  Use new l10nfile handling.
+
+	* localealias.c [!HAVE_ALLOCA]: Add code for handling missing
+        alloca code.
+
+	* l10nflist.c: Initial revision.
+
+Tue Apr  2 18:51:18 1996  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (all-gettext): New goal.  Same as all-yes.
+
+Thu Mar 28 23:01:22 1996  Karl Eichwalder  <ke@ke.central.de>
+
+	* Makefile.in (gettextsrcdir): Define using @datadir@.
+
+Tue Mar 26 12:39:14 1996  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c: Include <ctype.h>.  Reported by Roland McGrath.
+
+Sat Mar 23 02:00:35 1996  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing
+        with external declaration.
+
+Sat Mar  2 00:47:09 1996  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (all-no): Rename from all_no.
+
+Sat Feb 17 00:25:59 1996  Ulrich Drepper  <drepper@myware>
+
+	* gettextP.h [loaded_domain]: Array `successor' must now contain up
+        to 63 elements (because of codeset name normalization).
+
+	* finddomain.c: Implement codeset name normalization.
+
+Thu Feb 15 04:39:09 1996  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (all): Define to `all-@USE_NLS@'.
+	(all-yes, all_no): New goals.  `all-no' is noop, `all-yes'
+	is former all.
+
+Mon Jan 15 21:46:01 1996  Howard Gayle  <howard@hal.com>
+
+	* localealias.c (alias_compare): Increment string pointers in loop
+        of strcasecmp replacement.
+
+Fri Dec 29 21:16:34 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (install-src): Who commented this goal out ? :-)
+
+Fri Dec 29 15:08:16 1995  Ulrich Drepper  <drepper@myware>
+
+	* dcgettext.c (DCGETTEXT): Save `errno'.  Failing system calls
+	should not effect it because a missing catalog is no error.
+	Reported by Harald K<o:>nig <koenig@tat.physik.uni-tuebingen.de>.
+
+Tue Dec 19 22:09:13 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (Makefile): Explicitly use $(SHELL) for running
+        shell scripts.
+
+Fri Dec 15 17:34:59 1995  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile.in (install-src): Only install library and header when
+	we use the own implementation.  Don't do it when using the
+	system's gettext or catgets functions.
+
+	* dcgettext.c (find_msg): Must not swap domain->hash_size here.
+
+Sat Dec  9 16:24:37 1995  Ulrich Drepper  <drepper@myware>
+
+	* localealias.c, libintl.inst, libgettext.h, hash-string.h,
+	gettextP.h, finddomain.c, dcgettext.c, cat-compat.c:
+	Use PARAMS instead of __P.  Suggested by Roland McGrath.
+
+Tue Dec  5 11:39:14 1995  Larry Schwimmer  <rosebud@cyclone.stanford.edu>
+
+	* libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if
+	!_LIBINTL_H' because Solaris defines _LIBINTL_H as empty.
+
+Mon Dec  4 15:42:07 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (install-src):
+	Install libintl.inst instead of libintl.h.install.
+
+Sat Dec  2 22:51:38 1995  Marcus Daniels  <marcus@sysc.pdx.edu>
+
+	* cat-compat.c (textdomain):
+	Reverse order in which files are tried you load.  First
+	try local file, when this failed absolute path.
+
+Wed Nov 29 02:03:53 1995  Nelson H. F. Beebe  <beebe@math.utah.edu>
+
+	* cat-compat.c (bindtextdomain): Add missing { }.
+
+Sun Nov 26 18:21:41 1995  Ulrich Drepper  <drepper@myware>
+
+	* libintl.inst: Add missing __P definition.  Reported by Nelson Beebe.
+
+	* Makefile.in:
+	Add dummy `all' and `dvi' goals.  Reported by Tom Tromey.
+
+Sat Nov 25 16:12:01 1995  Franc,ois Pinard  <pinard@iro.umontreal.ca>
+
+	* hash-string.h: Capitalize arguments of macros.
+
+Sat Nov 25 12:01:36 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (DISTFILES): Prevent files names longer than 13
+	characters.  libintl.h.glibc->libintl.glibc,
+	libintl.h.install->libintl.inst.  Reported by Joshua R. Poulson.
+
+Sat Nov 25 11:31:12 1995  Eric Backus  <ericb@lsid.hp.com>
+
+	* dcgettext.c: Fix bug in preprocessor conditionals.
+
+Sat Nov 25 02:35:27 1995  Nelson H. F. Beebe  <beebe@math.utah.edu>
+
+	* libgettext.h: Solaris cc does not understand
+	 #if !SYMBOL1 && !SYMBOL2.  Sad	but true.
+
+Thu Nov 23 16:22:14 1995  Ulrich Drepper  <drepper@myware>
+
+	* hash-string.h (hash_string):
+	Fix for machine with >32 bit `unsigned long's.
+
+	* dcgettext.c (DCGETTEXT):
+	Fix horrible bug in loop for alternative translation.
+
+Thu Nov 23 01:45:29 1995  Ulrich Drepper  <drepper@myware>
+
+	* po2tbl.sed.in, linux-msg.sed, xopen-msg.sed:
+	Some further simplifications in message number generation.
+
+Mon Nov 20 21:08:43 1995  Ulrich Drepper  <drepper@myware>
+
+	* libintl.h.glibc: Use __const instead of const in prototypes.
+
+	* Makefile.in (install-src):
+	Install libintl.h.install instead of libintl.h.  This
+	is a stripped-down version.  Suggested by Peter Miller.
+
+	* libintl.h.install, libintl.h.glibc: Initial revision.
+
+	* localealias.c (_nl_expand_alias, read_alias_file):
+	Protect prototypes in type casts by __P.
+
+Tue Nov 14 16:43:58 1995  Ulrich Drepper  <drepper@myware>
+
+	* hash-string.h: Correct prototype for hash_string.
+
+Sun Nov 12 12:42:30 1995  Ulrich Drepper  <drepper@myware>
+
+	* hash-string.h (hash_string): Add prototype.
+
+	* gettextP.h: Fix copyright.
+	(SWAP): Add prototype.
+
+Wed Nov  8 22:56:33 1995  Ulrich Drepper  <drepper@myware>
+
+	* localealias.c (read_alias_file): Forgot sizeof.
+	Avoid calling *printf function.  This introduces a big overhead.
+	Patch by Roland McGrath.
+
+Tue Nov  7 14:21:08 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy.
+
+	* finddomain.c (stpcpy):
+	Define substitution function local.  The macro was to flaky.
+
+	* cat-compat.c: Fix typo.
+
+	* xopen-msg.sed, linux-msg.sed:
+	While bringing message number to right place only accept digits.
+
+	* linux-msg.sed, xopen-msg.sed: Now that the counter does not have
+	leading 0s we don't need to remove them.  Reported by Marcus
+	Daniels.
+
+	* Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in
+	dependency.  Reported by Marcus Daniels.
+
+	* cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement.
+	Generally cleanup using #if instead of #ifndef.
+
+	* Makefile.in: Correct typos in comment.  By Franc,ois Pinard.
+
+Mon Nov  6 00:27:02 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (install-src): Don't install libintl.h and libintl.a
+	if we use an available gettext implementation.
+
+Sun Nov  5 22:02:08 1995  Ulrich Drepper  <drepper@myware>
+
+	* libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS.  Reported
+	by Franc,ois Pinard.
+
+	* libgettext.h: Use #if instead of #ifdef/#ifndef.
+
+	* finddomain.c:
+	Comments describing what has to be done should start with FIXME.
+
+Sun Nov  5 19:38:01 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (DISTFILES): Split.  Use DISTFILES with normal meaning.
+	DISTFILES.common names the files common to both dist goals.
+	DISTFILES.gettext are the files only distributed in GNU gettext.
+
+Sun Nov  5 17:32:54 1995  Ulrich Drepper  <drepper@myware>
+
+	* dcgettext.c (DCGETTEXT): Correct searching in derived locales.
+	This was necessary since a change in _nl_find_msg several weeks
+	ago.  I really don't know this is still not fixed.
+
+Sun Nov  5 12:43:12 1995  Ulrich Drepper  <drepper@myware>
+
+	* loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL.  This
+	might mark a special condition.
+
+	* finddomain.c (make_entry_rec): Don't make illegal entry as decided.
+
+	* Makefile.in (dist): Suppress error message when ln failed.
+	Get files from $(srcdir) explicitly.
+
+	* libgettext.h (gettext_const): Rename to gettext_noop.
+
+Fri Nov  3 07:36:50 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (make_entry_rec):
+	Protect against wrong locale names by testing mask.
+
+	* libgettext.h (gettext_const): Add macro definition.
+	Capitalize macro arguments.
+
+Thu Nov  2 23:15:51 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (_nl_find_domain):
+	Test for pointer != NULL before accessing value.
+	Reported by Tom Tromey.
+
+	* gettext.c (NULL):
+	Define as (void*)0 instad of 0.  Reported by Franc,ois Pinard.
+
+Mon Oct 30 21:28:52 1995  Ulrich Drepper  <drepper@myware>
+
+	* po2tbl.sed.in: Serious typo bug fixed by Jim Meyering.
+
+Sat Oct 28 23:20:47 1995  Ulrich Drepper  <drepper@myware>
+
+	* libgettext.h: Disable dcgettext optimization for Solaris 2.3.
+
+	* localealias.c (alias_compare):
+	Peter Miller reported that tolower in some systems is
+	even dumber than I thought.  Protect call by `isupper'.
+
+Fri Oct 27 22:22:51 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (libdir, includedir): New variables.
+	(install-src): Install libintl.a and libintl.h in correct dirs.
+
+Fri Oct 27 22:07:29 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c.
+
+	* po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques.
+
+	* localealias.c:
+	Fix typo and superflous test.  Reported by Christian von Roques.
+
+Fri Oct  6 11:52:05 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (_nl_find_domain):
+	Correct some remainder from the pre-CEN syntax.  Now
+	we don't have a constant number of successors anymore.
+
+Wed Sep 27 21:41:13 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (DISTFILES): Add libintl.h.glibc.
+
+	* Makefile.in (dist-libc): Add goal for packing sources for glibc.
+	(COMSRCS, COMHDRS): Splitted to separate sources shared with glibc.
+
+	* loadmsgcat.c: Forget to continue #if line.
+
+	* localealias.c:
+	[_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name
+	space clean.
+
+	* dcgettext.c, finddomain.c: Better comment to last change.
+
+	* loadmsgcat.c:
+	[_LIBC]: Rename fstat, open, close, read, mmap, and munmap to
+	__fstat, __open, __close, __read, __mmap, and __munmap resp
+	to keep ANSI C name space clean.
+
+	* finddomain.c:
+	[_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean.
+
+	* dcgettext.c:
+	[_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to
+	keep ANSI C name space clean.
+
+	* libgettext.h:
+	Include sys/types.h for those old SysV systems out there.
+	Reported by Francesco Potorti`.
+
+	* loadmsgcat.c (use_mmap): Define if compiled for glibc.
+
+	* bindtextdom.c: Include all those standard headers
+	unconditionally if _LIBC is defined.
+
+	* finddomain.c: Fix 2 times defiend -> defined.
+
+	* textdomain.c: Include libintl.h instead of libgettext.h when
+	compiling for glibc.  Include all those standard headers
+	unconditionally if _LIBC is defined.
+
+	* localealias.c, loadmsgcat.c: Prepare to be compiled in glibc.
+
+	* gettext.c:
+	Include libintl.h instead of libgettext.h when compiling for glibc.
+	Get NULL from stddef.h if we compile for glibc.
+
+	* finddomain.c: Include libintl.h instead of libgettext.h when
+	compiling for glibc.  Include all those standard headers
+	unconditionally if _LIBC is defined.
+
+	* dcgettext.c: Include all those standard headers unconditionally
+	if _LIBC is defined.
+
+	* dgettext.c: If compiled in glibc include libintl.h instead of
+	libgettext.h.
+	(locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc.
+
+	* dcgettext.c: If compiled in glibc include libintl.h instead of
+	libgettext.h.
+	(getcwd): Don't rely on HAVE_GETCWD when compiling for glibc.
+
+	* bindtextdom.c:
+	If compiled in glibc include libintl.h instead of libgettext.h.
+
+Mon Sep 25 22:23:06 1995  Ulrich Drepper  <drepper@myware>
+
+	* localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0.
+	Reported by Marcus Daniels.
+
+	* cat-compat.c (bindtextdomain):
+	String used in putenv must not be recycled.
+	Reported by Marcus Daniels.
+
+	* libgettext.h (__USE_GNU_GETTEXT):
+	Additional symbol to signal that we use GNU gettext
+	library.
+
+	* cat-compat.c (bindtextdomain):
+	Fix bug with the strange stpcpy replacement.
+	Reported by Nelson Beebe.
+
+Sat Sep 23 08:23:51 1995  Ulrich Drepper  <drepper@myware>
+
+	* cat-compat.c: Include <string.h> for stpcpy prototype.
+
+	* localealias.c (read_alias_file):
+	While expand strdup code temporary variable `cp' hided
+	higher level variable with same name.  Rename to `tp'.
+
+	* textdomain.c (textdomain):
+	Avoid warning by using temporary variable in strdup code.
+
+	* finddomain.c (_nl_find_domain): Remove unused variable `application'.
+
+Thu Sep 21 15:51:44 1995  Ulrich Drepper  <drepper@myware>
+
+	* localealias.c (alias_compare):
+	Use strcasecmp() only if available.  Else use
+	implementation in place.
+
+	* intl-compat.c:
+	Wrapper functions now call *__ functions instead of __*.
+
+	* libgettext.h: Declare prototypes for *__ functions instead for __*.
+
+	* cat-compat.c, loadmsgcat.c:
+	Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
+	of the standard libc and so prevent libintl.a from being used
+	standalone.
+
+	* bindtextdom.c:
+	Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
+	of the standard libc and so prevent libintl.a from being used
+	standalone.
+	Rename to bindtextdomain__ if not used in GNU C Library.
+
+	* dgettext.c:
+	Rename function to dgettext__ if not used in GNU C Library.
+
+	* gettext.c:
+	Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
+	of the standard libc and so prevent libintl.a from being used
+	standalone.
+	Functions now called gettext__ if not used in GNU C Library.
+
+	* dcgettext.c, localealias.c, textdomain.c, finddomain.c:
+	Don't use xmalloc, xstrdup, and stpcpy.  These functions are not part
+	of the standard libc and so prevent libintl.a from being used
+	standalone.
+
+Sun Sep 17 23:14:49 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c: Correct some bugs in handling of CEN standard
+ 	locale definitions.
+
+Thu Sep  7 01:49:28 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c: Implement CEN syntax.
+
+	* gettextP.h (loaded_domain): Extend number of successors to 31.
+
+Sat Aug 19 19:25:29 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (aliaspath): Remove path to X11 locale dir.
+
+	* Makefile.in: Make install-src depend on install.  This helps
+ 	gettext to install the sources and other packages can use the
+ 	install goal.
+
+Sat Aug 19 15:19:33 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (uninstall): Remove stuff installed by install-src.
+
+Tue Aug 15 13:13:53 1995  Ulrich Drepper  <drepper@myware>
+
+	* VERSION.in: Initial revision.
+
+	* Makefile.in (DISTFILES):
+	Add VERSION file.  This is not necessary for gettext, but
+	for other packages using this library.
+
+Tue Aug 15 06:16:44 1995  Ulrich Drepper  <drepper@myware>
+
+	* gettextP.h (_nl_find_domain):
+	New prototype after changing search strategy.
+
+	* finddomain.c (_nl_find_domain):
+	We now try only to find a specified catalog.  Fall back to other
+	catalogs listed in the locale list is now done in __dcgettext.
+
+	* dcgettext.c (__dcgettext):
+	Now we provide message fall back even to different languages.
+	I.e. if a message is not available in one language all the other
+ 	in the locale list a tried.  Formerly fall back was only possible
+ 	within one language.  Implemented by moving one loop from
+ 	_nl_find_domain to here.
+
+Mon Aug 14 23:45:50 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (gettextsrcdir):
+	Directory where source of GNU gettext library are made
+	available.
+	(INSTALL, INSTALL_DATA): Programs used for installing sources.
+	(gettext-src): New.  Rule to install GNU gettext sources for use in
+	gettextize shell script.
+
+Sun Aug 13 14:40:48 1995  Ulrich Drepper  <drepper@myware>
+
+	* loadmsgcat.c (_nl_load_domain):
+	Use mmap for loading only when munmap function is
+	also available.
+
+	* Makefile.in (install): Depend on `all' goal.
+
+Wed Aug  9 11:04:33 1995  Ulrich Drepper  <drepper@myware>
+
+	* localealias.c (read_alias_file):
+	Do not overwrite '\n' when terminating alias value string.
+
+	* localealias.c (read_alias_file):
+	Handle long lines.  Ignore the rest not fitting in
+	the buffer after the initial `fgets' call.
+
+Wed Aug  9 00:54:29 1995  Ulrich Drepper  <drepper@myware>
+
+	* gettextP.h (_nl_load_domain):
+	Add prototype, replacing prototype for _nl_load_msg_cat.
+
+	* finddomain.c (_nl_find_domain):
+	Remove unneeded variable filename and filename_len.
+	(expand_alias): Remove prototype because functions does not
+ 	exist anymore.
+
+	* localealias.c (read_alias_file):
+	Change type of fname_len parameter to int.
+	(xmalloc): Add prototype.
+
+	* loadmsgcat.c: Better prototypes for xmalloc.
+
+Tue Aug  8 22:30:39 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (_nl_find_domain):
+	Allow alias name to be constructed from the four components.
+
+	* Makefile.in (aliaspath): New variable.  Set to preliminary value.
+	(SOURCES): Add localealias.c.
+	(OBJECTS): Add localealias.o.
+
+	* gettextP.h: Add prototype for _nl_expand_alias.
+
+	* finddomain.c: Aliasing handled in intl/localealias.c.
+
+	* localealias.c: Aliasing for locale names.
+
+	* bindtextdom.c: Better prototypes for xmalloc and xstrdup.
+
+Mon Aug  7 23:47:42 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (DISTFILES): gettext.perl is now found in misc/.
+
+	* cat-compat.c (bindtextdomain):
+	Correct implementation.  dirname parameter was not used.
+	Reported by Marcus Daniels.
+
+	* gettextP.h (loaded_domain):
+	New fields `successor' and `decided' for oo, lazy
+	message handling implementation.
+
+	* dcgettext.c:
+	Adopt for oo, lazy message handliing.
+  	Now we can inherit translations from less specific locales.
+	(find_msg): New function.
+
+	* loadmsgcat.c, finddomain.c:
+	Complete rewrite.  Implement oo, lazy message handling :-).
+  	We now have an additional environment variable `LANGUAGE' with
+ 	a higher priority than LC_ALL for the LC_MESSAGE locale.
+  	Here we can set a colon separated list of specifications each
+ 	of the form `language[_territory[.codeset]][@modifier]'.
+
+Sat Aug  5 09:55:42 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (unistd.h):
+	Include to get _PC_PATH_MAX defined on system having it.
+
+Fri Aug  4 22:42:00 1995  Ulrich Drepper  <drepper@myware>
+
+	* finddomain.c (stpcpy): Include prototype.
+
+	* Makefile.in (dist): Remove `copying instead' message.
+
+Wed Aug  2 18:52:03 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (ID, TAGS): Do not use $^.
+
+Tue Aug  1 20:07:11 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (TAGS, ID): Use $^ as command argument.
+	(TAGS): Give etags -o option t write to current directory,
+ 	not $(srcdir).
+	(ID): Use $(srcdir) instead os $(top_srcdir)/src.
+	(distclean): Remove ID.
+
+Sun Jul 30 11:51:46 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (gnulocaledir):
+	New variable, always using share/ for data directory.
+	(DEFS): Add GNULOCALEDIR, used in finddomain.c.
+
+	* finddomain.c (_nl_default_dirname):
+	Set to GNULOCALEDIR, because it always has to point
+	to the directory where GNU gettext Library writes it to.
+
+	* intl-compat.c (textdomain, bindtextdomain):
+	Undefine macros before function definition.
+
+Sat Jul 22 01:10:02 1995  Ulrich Drepper  <drepper@myware>
+
+	* libgettext.h (_LIBINTL_H):
+	Protect definition in case where this file is included as
+	libgettext.h on Solaris machines.  Add comment about this.
+
+Wed Jul 19 02:36:42 1995  Ulrich Drepper  <drepper@myware>
+
+	* intl-compat.c (textdomain): Correct typo.
+
+Wed Jul 19 01:51:35 1995  Ulrich Drepper  <drepper@myware>
+
+	* dcgettext.c (dcgettext): Function now called __dcgettext.
+
+	* dgettext.c (dgettext): Now called __dgettext and calls
+ 	__dcgettext.
+
+	* gettext.c (gettext):
+	Function now called __gettext and calls __dgettext.
+
+	* textdomain.c (textdomain): Function now called __textdomain.
+
+	* bindtextdom.c (bindtextdomain): Function now called
+ 	__bindtextdomain.
+
+	* intl-compat.c: Initial revision.
+
+	* Makefile.in (SOURCES): Add intl-compat.c.
+	(OBJECTS): We always compile the GNU gettext library functions.
+  	OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o,
+ 	and intl-compat.o.
+  	(GETTOBJS): Contains now only intl-compat.o.
+
+	* libgettext.h:
+	Re-include protection matches dualistic character of libgettext.h.
+	For all functions in GNU gettext library define __ counter part.
+
+	* finddomain.c (strchr): Define as index if not found in C library.
+	(_nl_find_domain): For relative paths paste / in between.
+
+Tue Jul 18 16:37:45 1995  Ulrich Drepper  <drepper@myware>
+
+	* loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h.
+
+	* xopen-msg.sed: Fix bug with `msgstr ""' lines.
+	A little bit better comments.
+
+Tue Jul 18 01:18:27 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in:
+	po-mode.el, makelinks, combine-sh are now found in ../misc.
+
+	* po-mode.el, makelinks, combine-sh, elisp-comp:
+	Moved to ../misc/.
+
+	* libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__.
+
+Sun Jul 16 22:33:02 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (INSTALL, INSTALL_DATA): New variables.
+	(install-data, uninstall): Install/uninstall .elc file.
+
+	* po-mode.el (Installation comment):
+	Add .pox as possible extension of .po files.
+
+Sun Jul 16 13:23:27 1995  Ulrich Drepper  <drepper@myware>
+
+	* elisp-comp: Complete new version by Franc,ois: This does not
+ 	fail when not compiling in the source directory.
+
+Sun Jul 16 00:12:17 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (../po/cat-id-tbl.o):
+	Use $(MAKE) instead of make for recursive make.
+
+	* Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh.
+	(install-exec): Add missing dummy goal.
+	(install-data, uninstall): @ in multi-line shell command at
+ 	beginning, not in front of echo.  Reported by Eric Backus.
+
+Sat Jul 15 00:21:28 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (DISTFILES):
+	Rename libgettext.perl to gettext.perl to fit in 14 chars
+	file systems.
+
+	* gettext.perl:
+ 	Rename to gettext.perl to fit in 14 chars file systems.
+
+Thu Jul 13 23:17:20 1995  Ulrich Drepper  <drepper@myware>
+
+	* cat-compat.c: If !STDC_HEADERS try to include malloc.h.
+
+Thu Jul 13 20:55:02 1995  Ulrich Drepper  <drepper@myware>
+
+	* po2tbl.sed.in: Pretty printing.
+
+	* linux-msg.sed, xopen-msg.sed:
+	Correct bugs with handling substitute flags in branches.
+
+	* hash-string.h (hash_string):
+	Old K&R compilers don't under stand `unsigned char'.
+
+	* gettext.h (nls_uint32):
+	Some old K&R compilers (eg HP) don't understand `unsigned int'.
+
+	* cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes.
+
+Thu Jul 13 01:34:33 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (ELCFILES): New variable.
+	(DISTFILES): Add elisp-comp.
+	Add implicit rule for .el -> .elc compilation.
+	(install-data): install $ELCFILES
+	(clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp.
+
+	* elisp-comp: Initial revision
+
+Wed Jul 12 16:14:52 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in:
+	cat-id-tbl.c is now found in po/.  This enables us to use an identical
+	intl/ directory in all packages.
+
+	* dcgettext.c (dcgettext): hashing does not work for table size <= 2.
+
+	* textdomain.c: fix typo (#if def -> #if defined)
+
+Tue Jul 11 18:44:43 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in (stamp-cat-id): use top_srcdir to address source files
+	(DISTFILES,distclean): move tupdate.perl to src/
+
+	* po-to-tbl.sed.in:
+	add additional jump to clear change flag to recognize multiline strings
+
+Tue Jul 11 01:32:50 1995  Ulrich Drepper  <drepper@myware>
+
+	* textdomain.c: Protect inclusion of stdlib.h and string.h.
+
+	* loadmsgcat.c: Protect inclusion of stdlib.h.
+
+	* libgettext.h: Protect inclusion of locale.h.
+	Allow use in C++ programs.
+	Define NULL is not happened already.
+
+	* Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of
+	po-to-tbl.sed.
+	(distclean): remove po-to-tbl.sed and tupdate.perl.
+
+	* tupdate.perl.in: Substitute Perl path even in exec line.
+	Don't include entries without translation from old .po file.
+
+Tue Jul  4 00:41:51 1995  Ulrich Drepper  <drepper@myware>
+
+	* tupdate.perl.in: use "Updated: " in msgid "".
+
+	* cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR).
+ 	Define getenv if !__STDC__.
+
+	* bindtextdom.c: Protect stdlib.h and string.h inclusion.
+ 	Define free if !__STDC__.
+
+	* finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+ 	Define free if !__STDC__.
+
+	* cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+
+Mon Jul  3 23:56:30 1995  Ulrich Drepper  <drepper@myware>
+
+	* Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR.
+	Remove unneeded $(srcdir) from Makefile.in dependency.
+
+	* makelinks: Add copyright and short description.
+
+	* po-mode.el: Last version for 0.7.
+
+	* tupdate.perl.in: Fix die message.
+
+	* dcgettext.c: Protect include of string.h.
+
+	* gettext.c: Protect include of stdlib.h and further tries to get NULL.
+
+	* finddomain.c: Some corrections in includes.
+
+	* Makefile.in (INCLUDES): Prune list correct path to Makefile.in.
+
+	* po-to-tbl.sed: Adopt for new .po file format.
+
+	* linux-msg.sed, xopen-msg.sed: Adopt for new .po file format.
+
+Sun Jul  2 23:55:03 1995  Ulrich Drepper  <drepper@myware>
+
+	* tupdate.perl.in: Complete rewrite for new .po file format.
+
+Sun Jul  2 02:06:50 1995  Ulrich Drepper  <drepper@myware>
+
+	* First official release.  This directory contains all the code
+	needed to internationalize own packages.  It provides functions
+	which allow to use the X/Open catgets function with an interface
+	like the Uniforum gettext function.  For system which does not
+	have neither of those a complete implementation is provided.
diff --git a/intl/Makefile.in b/intl/Makefile.in
new file mode 100644
index 0000000..09647de
--- /dev/null
+++ b/intl/Makefile.in
@@ -0,0 +1,214 @@
+# Makefile for directory with message catalog handling in GNU NLS Utilities.
+# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = ..
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+transform = @program_transform_name@
+libdir = $(exec_prefix)/lib
+includedir = $(prefix)/include
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = @datadir@/gettext/intl
+aliaspath = $(localedir):.
+subdir = intl
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+
+l = @l@
+
+AR = ar
+CC = @CC@
+LIBTOOL = @LIBTOOL@
+RANLIB = @RANLIB@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
+-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
+CPPFLAGS = @CPPFLAGS@
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+HEADERS = $(COMHDRS) libgettext.h loadinfo.h
+COMHDRS = gettext.h gettextP.h hash-string.h
+SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
+COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
+finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
+explodename.c
+OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
+finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
+explodename.$lo
+CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
+GETTOBJS = intl-compat.$lo
+DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
+xopen-msg.sed $(HEADERS) $(SOURCES)
+DISTFILES.normal = VERSION
+DISTFILES.gettext = libintl.glibc intlh.inst.in
+
+.SUFFIXES:
+.SUFFIXES: .c .o .lo
+.c.o:
+	$(COMPILE) $<
+.c.lo:
+	$(LIBTOOL) --mode=compile $(COMPILE) $<
+
+INCLUDES = -I. -I$(srcdir)
+
+all: all-@USE_INCLUDED_LIBINTL@
+
+all-yes: libintl.$la intlh.inst
+all-no:
+install-info:
+
+libintl.a: $(OBJECTS)
+	rm -f $@
+	$(AR) cru $@ $(OBJECTS)
+	$(RANLIB) $@
+
+libintl.la: $(OBJECTS)
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
+		   -version-info 1:0 -rpath $(libdir)
+
+../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
+	cd ../po && $(MAKE) cat-id-tbl.$lo
+
+check: all
+
+# This installation goal is only used in GNU gettext.  Packages which
+# only use the library should use install instead.
+
+# We must not install the libintl.h/libintl.a files if we are on a
+# system which has the gettext() function in its C library or in a
+# separate library or use the catgets interface.  A special case is
+# where configure found a previously installed GNU gettext library.
+# If you want to use the one which comes with this version of the
+# package, you have to use `configure --with-included-gettext'.
+install: install-exec install-data
+install-exec: all
+	if test "$(PACKAGE)" = "gettext" \
+	   && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
+	  if test -r $(MKINSTALLDIRS); then \
+	    $(MKINSTALLDIRS) $(libdir) $(includedir); \
+	  else \
+	    $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
+	  fi; \
+	  $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
+	  $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
+	else \
+	  : ; \
+	fi
+install-data: all
+	if test "$(PACKAGE)" = "gettext"; then \
+	  if test -r $(MKINSTALLDIRS); then \
+	    $(MKINSTALLDIRS) $(gettextsrcdir); \
+	  else \
+	    $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+	  fi; \
+	  $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
+	  dists="$(DISTFILES.common)"; \
+	  for file in $$dists; do \
+	    $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
+	  done; \
+	else \
+	  : ; \
+	fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+	dists="$(DISTFILES.common)"; \
+	for file in $$dists; do \
+	  rm -f $(gettextsrcdir)/$$file; \
+	done
+
+info dvi:
+
+$(OBJECTS): config.h libgettext.h
+bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
+dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
+
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES)
+	here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
+
+id: ID
+
+ID: $(HEADERS) $(SOURCES)
+	here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
+
+
+mostlyclean:
+	rm -f *.a *.o *.lo core core.*
+
+clean: mostlyclean
+
+distclean: clean
+	rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h config.log
+
+maintainer-clean: distclean
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+
+
+# GNU gettext needs not contain the file `VERSION' but contains some
+# other files which should not be distributed in other packages.
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: Makefile $(DISTFILES)
+	if test "$(PACKAGE)" = gettext; then \
+	  additional="$(DISTFILES.gettext)"; \
+	else \
+	  additional="$(DISTFILES.normal)"; \
+	fi; \
+	for file in $(DISTFILES.common) $$additional; do \
+	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+	    || cp -p $(srcdir)/$$file $(distdir); \
+	done
+
+dist-libc:
+	tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
+
+Makefile: Makefile.in config.status
+	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+# The dependency for intlh.inst is different in gettext and all other
+# packages.  Because we cannot you GNU make features we have to solve
+# the problem while rewriting Makefile.in.
+@GT_YES@intlh.inst: intlh.inst.in ../config.status
+@GT_YES@	cd .. \
+@GT_YES@	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
+@GT_YES@	  $(SHELL) ./config.status
+@GT_NO@.PHONY: intlh.inst
+@GT_NO@intlh.inst:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/intl/acconfig.h b/intl/acconfig.h
new file mode 100644
index 0000000..70f81f8
--- /dev/null
+++ b/intl/acconfig.h
@@ -0,0 +1,14 @@
+/* Define to 1 if NLS is requested.  */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext.  */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+#undef HAVE_GETTEXT
+
+/* Define as 1 if you have the stpcpy function.  */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES.  */
+#undef HAVE_LC_MESSAGES
diff --git a/intl/aclocal.m4 b/intl/aclocal.m4
new file mode 100644
index 0000000..225439f
--- /dev/null
+++ b/intl/aclocal.m4
@@ -0,0 +1,387 @@
+dnl aclocal.m4 generated automatically by aclocal 1.3
+
+dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+dnl This Makefile.in is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated.  We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+  case " <<$>>CONFIG_HEADERS " in
+  *" <<$>>am_file "*<<)>>
+    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+    ;;
+  esac
+  am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+
+# serial 1
+
+AC_DEFUN(AM_PROG_INSTALL,
+[AC_REQUIRE([AC_PROG_INSTALL])
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+AC_SUBST(INSTALL_SCRIPT)dnl
+])
+
+# This file is derived from `gettext.m4'.  The difference is that the
+# included macros assume Cygnus-style source and build trees.
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 3
+
+AC_DEFUN(CY_WITH_NLS,
+  [AC_MSG_CHECKING([whether NLS is requested])
+    dnl Default is enabled NLS
+    AC_ARG_ENABLE(nls,
+      [  --disable-nls           do not use Native Language Support],
+      USE_NLS=$enableval, USE_NLS=yes)
+    AC_MSG_RESULT($USE_NLS)
+    AC_SUBST(USE_NLS)
+
+    USE_INCLUDED_LIBINTL=no
+
+    dnl If we use NLS figure out what method
+    if test "$USE_NLS" = "yes"; then
+      AC_DEFINE(ENABLE_NLS)
+      AC_MSG_CHECKING([whether included gettext is requested])
+      AC_ARG_WITH(included-gettext,
+        [  --with-included-gettext use the GNU gettext library included here],
+        nls_cv_force_use_gnu_gettext=$withval,
+        nls_cv_force_use_gnu_gettext=no)
+      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If gettext or catgets are available (in this order) we
+        dnl use this.  Else we have to fall back to GNU NLS library.
+	dnl catgets is only used if permitted by option --with-catgets.
+	nls_cv_header_intl=
+	nls_cv_header_libgt=
+	CATOBJEXT=NONE
+
+	AC_CHECK_HEADER(libintl.h,
+	  [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
+	    [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+	       gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
+
+	   if test "$gt_cv_func_gettext_libc" != "yes"; then
+	     AC_CHECK_LIB(intl, bindtextdomain,
+	       [AC_CACHE_CHECK([for gettext in libintl],
+		 gt_cv_func_gettext_libintl,
+		 [AC_TRY_LINK([], [return (int) gettext ("")],
+		 gt_cv_func_gettext_libintl=yes,
+		 gt_cv_func_gettext_libintl=no)])])
+	   fi
+
+	   if test "$gt_cv_func_gettext_libc" = "yes" \
+	      || test "$gt_cv_func_gettext_libintl" = "yes"; then
+	      AC_DEFINE(HAVE_GETTEXT)
+	      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+		[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+	      if test "$MSGFMT" != "no"; then
+		AC_CHECK_FUNCS(dcgettext)
+		AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+		AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+		  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+		AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+			       return _nl_msg_cat_cntr],
+		  [CATOBJEXT=.gmo
+		   DATADIRNAME=share],
+		  [CATOBJEXT=.mo
+		   DATADIRNAME=lib])
+		INSTOBJEXT=.mo
+	      fi
+	    fi
+	])
+
+	dnl In the standard gettext, we would now check for catgets.
+        dnl However, we never want to use catgets for our releases.
+
+        if test "$CATOBJEXT" = "NONE"; then
+	  dnl Neither gettext nor catgets in included in the C library.
+	  dnl Fall back on GNU gettext library.
+	  nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions used to generate GNU NLS library.
+        INTLOBJS="\$(GETTOBJS)"
+        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+        AC_SUBST(MSGFMT)
+	USE_INCLUDED_LIBINTL=yes
+        CATOBJEXT=.gmo
+        INSTOBJEXT=.mo
+        DATADIRNAME=share
+	INTLDEPS='$(top_builddir)/../intl/libintl.a'
+	INTLLIBS=$INTLDEPS
+	LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+        nls_cv_header_intl=libintl.h
+        nls_cv_header_libgt=libgettext.h
+      fi
+
+      dnl Test whether we really found GNU xgettext.
+      if test "$XGETTEXT" != ":"; then
+	dnl If it is no GNU xgettext we define it as : so that the
+	dnl Makefiles still can work.
+	if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+	  : ;
+	else
+	  AC_MSG_RESULT(
+	    [found xgettext programs is not GNU xgettext; ignore it])
+	  XGETTEXT=":"
+	fi
+      fi
+
+      # We need to process the po/ directory.
+      POSUB=po
+    else
+      DATADIRNAME=share
+      nls_cv_header_intl=libintl.h
+      nls_cv_header_libgt=libgettext.h
+    fi
+
+    # If this is used in GNU gettext we have to set USE_NLS to `yes'
+    # because some of the sources are only built for this goal.
+    if test "$PACKAGE" = gettext; then
+      USE_NLS=yes
+      USE_INCLUDED_LIBINTL=yes
+    fi
+
+    dnl These rules are solely for the distribution goal.  While doing this
+    dnl we only have to keep exactly one list of the available catalogs
+    dnl in configure.in.
+    for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATALOGS)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(DATADIRNAME)
+    AC_SUBST(GMOFILES)
+    AC_SUBST(INSTOBJEXT)
+    AC_SUBST(INTLDEPS)
+    AC_SUBST(INTLLIBS)
+    AC_SUBST(INTLOBJS)
+    AC_SUBST(POFILES)
+    AC_SUBST(POSUB)
+  ])
+
+AC_DEFUN(CY_GNU_GETTEXT,
+  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+   AC_REQUIRE([AC_PROG_CC])dnl
+   AC_REQUIRE([AC_PROG_RANLIB])dnl
+   AC_REQUIRE([AC_ISC_POSIX])dnl
+   AC_REQUIRE([AC_HEADER_STDC])dnl
+   AC_REQUIRE([AC_C_CONST])dnl
+   AC_REQUIRE([AC_C_INLINE])dnl
+   AC_REQUIRE([AC_TYPE_OFF_T])dnl
+   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+   AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h])
+   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next])
+
+   if test "${ac_cv_func_stpcpy+set}" != "set"; then
+     AC_CHECK_FUNCS(stpcpy)
+   fi
+   if test "${ac_cv_func_stpcpy}" = "yes"; then
+     AC_DEFINE(HAVE_STPCPY)
+   fi
+
+   AM_LC_MESSAGES
+   CY_WITH_NLS
+
+   if test "x$CATOBJEXT" != "x"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       AC_MSG_CHECKING(for catalogs to be installed)
+       NEW_LINGUAS=
+       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+         case "$ALL_LINGUAS" in
+          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+         esac
+       done
+       LINGUAS=$NEW_LINGUAS
+       AC_MSG_RESULT($LINGUAS)
+     fi
+
+     dnl Construct list of names of catalog files to be constructed.
+     if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     fi
+   fi
+
+   dnl The reference to <locale.h> in the installed <libintl.h> file
+   dnl must be resolved because we cannot expect the users of this
+   dnl to define HAVE_LOCALE_H.
+   if test $ac_cv_header_locale_h = yes; then
+     INCLUDE_LOCALE_H="#include <locale.h>"
+   else
+     INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>.  Take care yourself.  */"
+   fi
+   AC_SUBST(INCLUDE_LOCALE_H)
+
+   dnl Determine which catalog format we have (if any is needed)
+   dnl For now we know about two different formats:
+   dnl   Linux libc-5 and the normal X/Open format
+   if test -f $srcdir/po2tbl.sed.in; then
+      if test "$CATOBJEXT" = ".cat"; then
+	 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+	 dnl Transform the SED scripts while copying because some dumb SEDs
+         dnl cannot handle comments.
+	 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+      fi
+      dnl po2tbl.sed is always needed.
+      sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+	 $srcdir/po2tbl.sed.in > po2tbl.sed
+   fi
+
+   dnl In the intl/Makefile.in we have a special dependency which makes
+   dnl only sense for gettext.  We comment this out for non-gettext
+   dnl packages.
+   if test "$PACKAGE" = "gettext"; then
+     GT_NO="#NO#"
+     GT_YES=
+   else
+     GT_NO=
+     GT_YES="#YES#"
+   fi
+   AC_SUBST(GT_NO)
+   AC_SUBST(GT_YES)
+
+   MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+   AC_SUBST(MKINSTALLDIRS)
+
+   dnl *** For now the libtool support in intl/Makefile is not for real.
+   l=
+   AC_SUBST(l)
+
+   dnl Generate list of files to be processed by xgettext which will
+   dnl be included in po/Makefile.  But only do this if the po directory
+   dnl exists in srcdir.
+   if test -d $srcdir/po; then
+      test -d po || mkdir po
+      if test "x$srcdir" != "x."; then
+	 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+	    posrcprefix="$srcdir/"
+	 else
+	    posrcprefix="../$srcdir/"
+	 fi
+      else
+	 posrcprefix="../"
+      fi
+      rm -f po/POTFILES
+      sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+	 < $srcdir/po/POTFILES.in > po/POTFILES
+   fi
+  ])
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN(AM_PATH_PROG_WITH_TEST,
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  /*)
+  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if [$3]; then
+	ac_cv_path_$1="$ac_dir/$ac_word"
+	break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+  ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test -n "[$]$1"; then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AM_LC_MESSAGES,
+  [if test $ac_cv_header_locale_h = yes; then
+    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+    if test $am_cv_val_LC_MESSAGES = yes; then
+      AC_DEFINE(HAVE_LC_MESSAGES)
+    fi
+  fi])
+
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
new file mode 100644
index 0000000..d9c3f34
--- /dev/null
+++ b/intl/bindtextdom.c
@@ -0,0 +1,203 @@
+/* Implementation of the bindtextdomain(3) function
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+# ifdef HAVE_MALLOC_H
+#  include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+/* Contains the default location of the message catalogs.  */
+extern const char _nl_default_dirname[];
+
+/* List with bindings of specific domains.  */
+extern struct binding *_nl_domain_bindings;
+
+
+/* Names for the libintl functions are a problem.  They must not clash
+   with existing names and they should follow ANSI C.  But this source
+   code is also used in GNU C Library where the names have a __
+   prefix.  So we have to make a difference here.  */
+#ifdef _LIBC
+# define BINDTEXTDOMAIN __bindtextdomain
+# ifndef strdup
+#  define strdup(str) __strdup (str)
+# endif
+#else
+# define BINDTEXTDOMAIN bindtextdomain__
+#endif
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+char *
+BINDTEXTDOMAIN (domainname, dirname)
+     const char *domainname;
+     const char *dirname;
+{
+  struct binding *binding;
+
+  /* Some sanity checks.  */
+  if (domainname == NULL || domainname[0] == '\0')
+    return NULL;
+
+  for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+    {
+      int compare = strcmp (domainname, binding->domainname);
+      if (compare == 0)
+	/* We found it!  */
+	break;
+      if (compare < 0)
+	{
+	  /* It is not in the list.  */
+	  binding = NULL;
+	  break;
+	}
+    }
+
+  if (dirname == NULL)
+    /* The current binding has be to returned.  */
+    return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
+
+  if (binding != NULL)
+    {
+      /* The domain is already bound.  If the new value and the old
+	 one are equal we simply do nothing.  Otherwise replace the
+	 old binding.  */
+      if (strcmp (dirname, binding->dirname) != 0)
+	{
+	  char *new_dirname;
+
+	  if (strcmp (dirname, _nl_default_dirname) == 0)
+	    new_dirname = (char *) _nl_default_dirname;
+	  else
+	    {
+#if defined _LIBC || defined HAVE_STRDUP
+	      new_dirname = strdup (dirname);
+	      if (new_dirname == NULL)
+		return NULL;
+#else
+	      size_t len = strlen (dirname) + 1;
+	      new_dirname = (char *) malloc (len);
+	      if (new_dirname == NULL)
+		return NULL;
+
+	      memcpy (new_dirname, dirname, len);
+#endif
+	    }
+
+	  if (binding->dirname != _nl_default_dirname)
+	    free (binding->dirname);
+
+	  binding->dirname = new_dirname;
+	}
+    }
+  else
+    {
+      /* We have to create a new binding.  */
+#if !defined _LIBC && !defined HAVE_STRDUP
+      size_t len;
+#endif
+      struct binding *new_binding =
+	(struct binding *) malloc (sizeof (*new_binding));
+
+      if (new_binding == NULL)
+	return NULL;
+
+#if defined _LIBC || defined HAVE_STRDUP
+      new_binding->domainname = strdup (domainname);
+      if (new_binding->domainname == NULL)
+	return NULL;
+#else
+      len = strlen (domainname) + 1;
+      new_binding->domainname = (char *) malloc (len);
+      if (new_binding->domainname == NULL)
+	return NULL;
+      memcpy (new_binding->domainname, domainname, len);
+#endif
+
+      if (strcmp (dirname, _nl_default_dirname) == 0)
+	new_binding->dirname = (char *) _nl_default_dirname;
+      else
+	{
+#if defined _LIBC || defined HAVE_STRDUP
+	  new_binding->dirname = strdup (dirname);
+	  if (new_binding->dirname == NULL)
+	    return NULL;
+#else
+	  len = strlen (dirname) + 1;
+	  new_binding->dirname = (char *) malloc (len);
+	  if (new_binding->dirname == NULL)
+	    return NULL;
+	  memcpy (new_binding->dirname, dirname, len);
+#endif
+	}
+
+      /* Now enqueue it.  */
+      if (_nl_domain_bindings == NULL
+	  || strcmp (domainname, _nl_domain_bindings->domainname) < 0)
+	{
+	  new_binding->next = _nl_domain_bindings;
+	  _nl_domain_bindings = new_binding;
+	}
+      else
+	{
+	  binding = _nl_domain_bindings;
+	  while (binding->next != NULL
+		 && strcmp (domainname, binding->next->domainname) > 0)
+	    binding = binding->next;
+
+	  new_binding->next = binding->next;
+	  binding->next = new_binding;
+	}
+
+      binding = new_binding;
+    }
+
+  return binding->dirname;
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library.  */
+weak_alias (__bindtextdomain, bindtextdomain);
+#endif
diff --git a/intl/cat-compat.c b/intl/cat-compat.c
new file mode 100644
index 0000000..867d901
--- /dev/null
+++ b/intl/cat-compat.c
@@ -0,0 +1,262 @@
+/* Compatibility code for gettext-using-catgets interface.
+   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+#  include <malloc.h>
+# endif
+#endif
+
+#ifdef HAVE_NL_TYPES_H
+# include <nl_types.h>
+#endif
+
+#include "libgettext.h"
+
+/* @@ end of prolog @@ */
+
+/* XPG3 defines the result of `setlocale (category, NULL)' as:
+   ``Directs `setlocale()' to query `category' and return the current
+     setting of `local'.''
+   However it does not specify the exact format.  And even worse: POSIX
+   defines this not at all.  So we can use this feature only on selected
+   system (e.g. those using GNU C Library).  */
+#ifdef _LIBC
+# define HAVE_LOCALE_NULL
+#endif
+
+/* The catalog descriptor.  */
+static nl_catd catalog = (nl_catd) -1;
+
+/* Name of the default catalog.  */
+static const char default_catalog_name[] = "messages";
+
+/* Name of currently used catalog.  */
+static const char *catalog_name = default_catalog_name;
+
+/* Get ID for given string.  If not found return -1.  */
+static int msg_to_cat_id PARAMS ((const char *msg));
+
+/* Substitution for systems lacking this function in their C library.  */
+#if !_LIBC && !HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+#endif
+
+
+/* Set currently used domain/catalog.  */
+char *
+textdomain (domainname)
+     const char *domainname;
+{
+  nl_catd new_catalog;
+  char *new_name;
+  size_t new_name_len;
+  char *lang;
+
+#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \
+    && defined HAVE_LOCALE_NULL
+  lang = setlocale (LC_MESSAGES, NULL);
+#else
+  lang = getenv ("LC_ALL");
+  if (lang == NULL || lang[0] == '\0')
+    {
+      lang = getenv ("LC_MESSAGES");
+      if (lang == NULL || lang[0] == '\0')
+	lang = getenv ("LANG");
+    }
+#endif
+  if (lang == NULL || lang[0] == '\0')
+    lang = "C";
+
+  /* See whether name of currently used domain is asked.  */
+  if (domainname == NULL)
+    return (char *) catalog_name;
+
+  if (domainname[0] == '\0')
+    domainname = default_catalog_name;
+
+  /* Compute length of added path element.  */
+  new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang)
+		 + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1
+		 + sizeof (".cat");
+
+  new_name = (char *) malloc (new_name_len);
+  if (new_name == NULL)
+    return NULL;
+
+  strcpy (new_name, PACKAGE);
+  new_catalog = catopen (new_name, 0);
+
+  if (new_catalog == (nl_catd) -1)
+    {
+      /* NLSPATH search didn't work, try absolute path */
+      sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang,
+	       PACKAGE);
+      new_catalog = catopen (new_name, 0);
+
+      if (new_catalog == (nl_catd) -1)
+	{
+	  free (new_name);
+	  return (char *) catalog_name;
+	}
+    }
+
+  /* Close old catalog.  */
+  if (catalog != (nl_catd) -1)
+    catclose (catalog);
+  if (catalog_name != default_catalog_name)
+    free ((char *) catalog_name);
+
+  catalog = new_catalog;
+  catalog_name = new_name;
+
+  return (char *) catalog_name;
+}
+
+char *
+bindtextdomain (domainname, dirname)
+     const char *domainname;
+     const char *dirname;
+{
+#if HAVE_SETENV || HAVE_PUTENV
+  char *old_val, *new_val, *cp;
+  size_t new_val_len;
+
+  /* This does not make much sense here but to be compatible do it.  */
+  if (domainname == NULL)
+    return NULL;
+
+  /* Compute length of added path element.  If we use setenv we don't need
+     the first byts for NLSPATH=, but why complicate the code for this
+     peanuts.  */
+  new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname)
+		+ sizeof ("/%L/LC_MESSAGES/%N.cat");
+
+  old_val = getenv ("NLSPATH");
+  if (old_val == NULL || old_val[0] == '\0')
+    {
+      old_val = NULL;
+      new_val_len += 1 + sizeof (LOCALEDIR) - 1
+	             + sizeof ("/%L/LC_MESSAGES/%N.cat");
+    }
+  else
+    new_val_len += strlen (old_val);
+
+  new_val = (char *) malloc (new_val_len);
+  if (new_val == NULL)
+    return NULL;
+
+# if HAVE_SETENV
+  cp = new_val;
+# else
+  cp = stpcpy (new_val, "NLSPATH=");
+# endif
+
+  cp = stpcpy (cp, dirname);
+  cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:");
+
+  if (old_val == NULL)
+    {
+# if __STDC__
+      stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat");
+# else
+
+      cp = stpcpy (cp, LOCALEDIR);
+      stpcpy (cp, "/%L/LC_MESSAGES/%N.cat");
+# endif
+    }
+  else
+    stpcpy (cp, old_val);
+
+# if HAVE_SETENV
+  setenv ("NLSPATH", new_val, 1);
+  free (new_val);
+# else
+  putenv (new_val);
+  /* Do *not* free the environment entry we just entered.  It is used
+     from now on.   */
+# endif
+
+#endif
+
+  return (char *) domainname;
+}
+
+#undef gettext
+char *
+gettext (msg)
+     const char *msg;
+{
+  int msgid;
+
+  if (msg == NULL || catalog == (nl_catd) -1)
+    return (char *) msg;
+
+  /* Get the message from the catalog.  We always use set number 1.
+     The message ID is computed by the function `msg_to_cat_id'
+     which works on the table generated by `po-to-tbl'.  */
+  msgid = msg_to_cat_id (msg);
+  if (msgid == -1)
+    return (char *) msg;
+
+  return catgets (catalog, 1, msgid, (char *) msg);
+}
+
+/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries
+   for the one equal to msg.  If it is found return the ID.  In case when
+   the string is not found return -1.  */
+static int
+msg_to_cat_id (msg)
+     const char *msg;
+{
+  int cnt;
+
+  for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
+    if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
+      return _msg_tbl[cnt]._msg_number;
+
+  return -1;
+}
+
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library.  So we
+   avoid the non-standard function stpcpy.  In GNU C Library this
+   function is available, though.  Also allow the symbol HAVE_STPCPY
+   to be defined.  */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+     char *dest;
+     const char *src;
+{
+  while ((*dest++ = *src++) != '\0')
+    /* Do nothing. */ ;
+  return dest - 1;
+}
+#endif
diff --git a/intl/config.in b/intl/config.in
new file mode 100644
index 0000000..8a9049b
--- /dev/null
+++ b/intl/config.in
@@ -0,0 +1,128 @@
+/* config.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define if using alloca.c.  */
+#undef C_ALLOCA
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro.  */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have a working `mmap' system call.  */
+#undef HAVE_MMAP
+
+/* Define as __inline if that's what the C compiler calls it.  */
+#undef inline
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define if you need to in order for stat and other things to work.  */
+#undef _POSIX_SOURCE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define to 1 if NLS is requested.  */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext.  */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+#undef HAVE_GETTEXT
+
+/* Define as 1 if you have the stpcpy function.  */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES.  */
+#undef HAVE_LC_MESSAGES
+
+/* Define if you have the __argz_count function.  */
+#undef HAVE___ARGZ_COUNT
+
+/* Define if you have the __argz_next function.  */
+#undef HAVE___ARGZ_NEXT
+
+/* Define if you have the __argz_stringify function.  */
+#undef HAVE___ARGZ_STRINGIFY
+
+/* Define if you have the dcgettext function.  */
+#undef HAVE_DCGETTEXT
+
+/* Define if you have the getcwd function.  */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function.  */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the munmap function.  */
+#undef HAVE_MUNMAP
+
+/* Define if you have the putenv function.  */
+#undef HAVE_PUTENV
+
+/* Define if you have the setenv function.  */
+#undef HAVE_SETENV
+
+/* Define if you have the setlocale function.  */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the stpcpy function.  */
+#undef HAVE_STPCPY
+
+/* Define if you have the strcasecmp function.  */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strchr function.  */
+#undef HAVE_STRCHR
+
+/* Define if you have the <argz.h> header file.  */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <limits.h> header file.  */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <locale.h> header file.  */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <nl_types.h> header file.  */
+#undef HAVE_NL_TYPES_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <values.h> header file.  */
+#undef HAVE_VALUES_H
+
+/* Define if you have the i library (-li).  */
+#undef HAVE_LIBI
diff --git a/intl/configure b/intl/configure
new file mode 100755
index 0000000..341eea0
--- /dev/null
+++ b/intl/configure
@@ -0,0 +1,2950 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12.1 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --disable-nls           do not use Native Language Support"
+ac_help="$ac_help
+  --with-included-gettext use the GNU gettext library included here"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.12.1"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=dgettext.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:562: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:616: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 631 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 648 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:677: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+	@echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:706: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:735: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  ac_prog_rejected=no
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:783: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 793 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:817: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:822: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:846: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+  if test "$ac_test_CFLAGS" = set; then
+    CFLAGS="$ac_save_CFLAGS"
+  elif test $ac_cv_prog_cc_g = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:876: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:903: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
+  echo "$ac_t""yes" 1>&6
+  ISC=yes # If later tests want to check for ISC.
+  cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+  if test "$GCC" = yes; then
+    CC="$CC -posix"
+  else
+    CC="$CC -Xp"
+  fi
+else
+  echo "$ac_t""no" 1>&6
+  ISC=
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:924: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 929 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 954 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 972 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 993 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1028: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1033 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1103: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat > conftest.$ac_ext <<EOF
+#line 1110 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_inline=$ac_kw; break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+  inline | yes) ;;
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:1143: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1148 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_off_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1176: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1181 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_size_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+  cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:1211: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1216 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  ac_cv_header_alloca_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:1244: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1249 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  ac_cv_func_alloca_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.o
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:1304: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1309 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_os_cray=yes
+else
+  rm -rf conftest*
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1334: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1339 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:1389: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1397 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:1416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1441: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1446 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1480: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1485 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:1533: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1541 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+	mmap private not fixed
+	mmap private fixed at somewhere currently unmapped
+	mmap private fixed at somewhere already mapped
+	mmap shared not fixed
+	mmap shared fixed at somewhere currently unmapped
+	mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the filesystem buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h.  */
+# ifndef HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192	/* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+	char *data, *data2, *data3;
+	int i, pagesize;
+	int fd;
+
+	pagesize = getpagesize();
+
+	/*
+	 * First, make a file with some known garbage in it.
+	 */
+	data = malloc(pagesize);
+	if (!data)
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		*(data + i) = rand();
+	umask(0);
+	fd = creat("conftestmmap", 0600);
+	if (fd < 0)
+		exit(1);
+	if (write(fd, data, pagesize) != pagesize)
+		exit(1);
+	close(fd);
+
+	/*
+	 * Next, try to mmap the file at a fixed address which
+	 * already has something else allocated at it.  If we can,
+	 * also make sure that we see the same garbage.
+	 */
+	fd = open("conftestmmap", O_RDWR);
+	if (fd < 0)
+		exit(1);
+	data2 = malloc(2 * pagesize);
+	if (!data2)
+		exit(1);
+	data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+	if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+	    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		if (*(data + i) != *(data2 + i))
+			exit(1);
+
+	/*
+	 * Finally, make sure that changes to the mapped area
+	 * do not percolate back to the file as seen by read().
+	 * (This is a bug on some variants of i386 svr4.0.)
+	 */
+	for (i = 0; i < pagesize; ++i)
+		*(data2 + i) = *(data2 + i) + 1;
+	data3 = malloc(pagesize);
+	if (!data3)
+		exit(1);
+	if (read(fd, data3, pagesize) != pagesize)
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		if (*(data + i) != *(data3 + i))
+			exit(1);
+	close(fd);
+	unlink("conftestmmap");
+	exit(0);
+}
+
+EOF
+if { (eval echo configure:1681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+                              
+   for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1709: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1714 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+   for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1749: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1754 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+   if test "${ac_cv_func_stpcpy+set}" != "set"; then
+     for ac_func in stpcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1806: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1811 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+   fi
+   if test "${ac_cv_func_stpcpy}" = "yes"; then
+     cat >> confdefs.h <<\EOF
+#define HAVE_STPCPY 1
+EOF
+
+   fi
+
+   if test $ac_cv_header_locale_h = yes; then
+    echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:1868: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1873 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  am_cv_val_LC_MESSAGES=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  am_cv_val_LC_MESSAGES=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+    if test $am_cv_val_LC_MESSAGES = yes; then
+      cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+
+    fi
+  fi
+   echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+echo "configure:1901: checking whether NLS is requested" >&5
+        # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+  enableval="$enable_nls"
+  USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi
+
+    echo "$ac_t""$USE_NLS" 1>&6
+    
+
+    USE_INCLUDED_LIBINTL=no
+
+        if test "$USE_NLS" = "yes"; then
+      cat >> confdefs.h <<\EOF
+#define ENABLE_NLS 1
+EOF
+
+      echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+echo "configure:1921: checking whether included gettext is requested" >&5
+      # Check whether --with-included-gettext or --without-included-gettext was given.
+if test "${with_included_gettext+set}" = set; then
+  withval="$with_included_gettext"
+  nls_cv_force_use_gnu_gettext=$withval
+else
+  nls_cv_force_use_gnu_gettext=no
+fi
+
+      echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+                        		nls_cv_header_intl=
+	nls_cv_header_libgt=
+	CATOBJEXT=NONE
+
+	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+echo "configure:1940: checking for libintl.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1945 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:1967: checking for gettext in libc" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1972 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  gt_cv_func_gettext_libc=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  gt_cv_func_gettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+
+	   if test "$gt_cv_func_gettext_libc" != "yes"; then
+	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:1995: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lintl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2003 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:2014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
+echo "configure:2030: checking for gettext in libintl" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2035 "configure"
+#include "confdefs.h"
+
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  gt_cv_func_gettext_libintl=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  gt_cv_func_gettext_libintl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	   fi
+
+	   if test "$gt_cv_func_gettext_libc" = "yes" \
+	      || test "$gt_cv_func_gettext_libintl" = "yes"; then
+	      cat >> confdefs.h <<\EOF
+#define HAVE_GETTEXT 1
+EOF
+
+	      # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2070: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MSGFMT" in
+  /*)
+  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+	ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+	break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+  ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+  echo "$ac_t""$MSGFMT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+	      if test "$MSGFMT" != "no"; then
+		for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2104: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2109 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+		# Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2159: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$GMSGFMT" in
+  /*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+  echo "$ac_t""$GMSGFMT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+		# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2194: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$XGETTEXT" in
+  /*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+	ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+	break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+  ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+  echo "$ac_t""$XGETTEXT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+		cat > conftest.$ac_ext <<EOF
+#line 2226 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+			       return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  CATOBJEXT=.gmo
+		   DATADIRNAME=share
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CATOBJEXT=.mo
+		   DATADIRNAME=lib
+fi
+rm -f conftest*
+		INSTOBJEXT=.mo
+	      fi
+	    fi
+	
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+	        
+        if test "$CATOBJEXT" = "NONE"; then
+	  	  	  nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+                INTLOBJS="\$(GETTOBJS)"
+        # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2266: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MSGFMT" in
+  /*)
+  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+	ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+	break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+  ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+  echo "$ac_t""$MSGFMT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+        # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2300: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$GMSGFMT" in
+  /*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+  echo "$ac_t""$GMSGFMT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+        # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2335: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$XGETTEXT" in
+  /*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+	ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+	break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+  ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+  echo "$ac_t""$XGETTEXT" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+        
+	USE_INCLUDED_LIBINTL=yes
+        CATOBJEXT=.gmo
+        INSTOBJEXT=.mo
+        DATADIRNAME=share
+	INTLDEPS='$(top_builddir)/../intl/libintl.a'
+	INTLLIBS=$INTLDEPS
+	LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+        nls_cv_header_intl=libintl.h
+        nls_cv_header_libgt=libgettext.h
+      fi
+
+            if test "$XGETTEXT" != ":"; then
+			if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+	  : ;
+	else
+	  echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
+	  XGETTEXT=":"
+	fi
+      fi
+
+      # We need to process the po/ directory.
+      POSUB=po
+    else
+      DATADIRNAME=share
+      nls_cv_header_intl=libintl.h
+      nls_cv_header_libgt=libgettext.h
+    fi
+
+    # If this is used in GNU gettext we have to set USE_NLS to `yes'
+    # because some of the sources are only built for this goal.
+    if test "$PACKAGE" = gettext; then
+      USE_NLS=yes
+      USE_INCLUDED_LIBINTL=yes
+    fi
+
+                for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+        
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+
+   if test "x$CATOBJEXT" != "x"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+echo "configure:2425: checking for catalogs to be installed" >&5
+       NEW_LINGUAS=
+       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+         case "$ALL_LINGUAS" in
+          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+         esac
+       done
+       LINGUAS=$NEW_LINGUAS
+       echo "$ac_t""$LINGUAS" 1>&6
+     fi
+
+          if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     fi
+   fi
+
+            if test $ac_cv_header_locale_h = yes; then
+     INCLUDE_LOCALE_H="#include <locale.h>"
+   else
+     INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>.  Take care yourself.  */"
+   fi
+   
+
+            if test -f $srcdir/po2tbl.sed.in; then
+      if test "$CATOBJEXT" = ".cat"; then
+	 ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+echo "configure:2453: checking for linux/version.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2458 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  msgformat=linux
+else
+  echo "$ac_t""no" 1>&6
+msgformat=xopen
+fi
+
+
+	          	 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+      fi
+            sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+	 $srcdir/po2tbl.sed.in > po2tbl.sed
+   fi
+
+            if test "$PACKAGE" = "gettext"; then
+     GT_NO="#NO#"
+     GT_YES=
+   else
+     GT_NO=
+     GT_YES="#YES#"
+   fi
+   
+   
+
+   MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+   
+
+      l=
+   
+
+            if test -d $srcdir/po; then
+      test -d po || mkdir po
+      if test "x$srcdir" != "x."; then
+	 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+	    posrcprefix="$srcdir/"
+	 else
+	    posrcprefix="../$srcdir/"
+	 fi
+      else
+	 posrcprefix="../"
+      fi
+      rm -f po/POTFILES
+      sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+	 < $srcdir/po/POTFILES.in > po/POTFILES
+   fi
+  
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set) 2>&1 | grep ac_space` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.12.1"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@RANLIB@%$RANLIB%g
+s%@CPP@%$CPP%g
+s%@ALLOCA@%$ALLOCA%g
+s%@USE_NLS@%$USE_NLS%g
+s%@MSGFMT@%$MSGFMT%g
+s%@GMSGFMT@%$GMSGFMT%g
+s%@XGETTEXT@%$XGETTEXT%g
+s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
+s%@CATALOGS@%$CATALOGS%g
+s%@CATOBJEXT@%$CATOBJEXT%g
+s%@DATADIRNAME@%$DATADIRNAME%g
+s%@GMOFILES@%$GMOFILES%g
+s%@INSTOBJEXT@%$INSTOBJEXT%g
+s%@INTLDEPS@%$INTLDEPS%g
+s%@INTLLIBS@%$INTLLIBS%g
+s%@INTLOBJS@%$INTLOBJS%g
+s%@POFILES@%$POFILES%g
+s%@POSUB@%$POSUB%g
+s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
+s%@GT_NO@%$GT_NO%g
+s%@GT_YES@%$GT_YES%g
+s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
+s%@l@%$l%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="config.h:config.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+ac_sources="$nls_cv_header_libgt"
+ac_dests="$nls_cv_header_intl"
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+srcdir=$ac_given_srcdir
+while test -n "$ac_sources"; do
+  set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+  set $ac_sources; ac_source=$1; shift; ac_sources=$*
+
+  echo "linking $srcdir/$ac_source to $ac_dest"
+
+  if test ! -r $srcdir/$ac_source; then
+    { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
+  fi
+  rm -f $ac_dest
+
+  # Make relative symlinks.
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
+    # The dest file is in a subdirectory.
+    test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+    ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dest_dir_suffix.
+    ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dest_dir_suffix= ac_dots=
+  fi
+
+  case "$srcdir" in
+  [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
+  *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
+  esac
+
+  # Make a symlink if possible; otherwise try a hard link.
+  if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
+    ln $srcdir/$ac_source $ac_dest; then :
+  else
+    { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
+  fi
+done
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/intl/configure.in b/intl/configure.in
new file mode 100644
index 0000000..4ba9c24
--- /dev/null
+++ b/intl/configure.in
@@ -0,0 +1,10 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(dgettext.c)
+AM_CONFIG_HEADER(config.h:config.in)
+
+AM_PROG_INSTALL
+CY_GNU_GETTEXT
+AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+
+AC_OUTPUT(Makefile)
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
new file mode 100644
index 0000000..c4c7a2c
--- /dev/null
+++ b/intl/dcgettext.c
@@ -0,0 +1,624 @@
+/* Implementation of the dcgettext(3) function.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+# define HAVE_ALLOCA 1
+#else
+# if defined HAVE_ALLOCA_H || defined _LIBC
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+#  include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+#  define _GNU_SOURCE	1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+#  define strchr index
+# endif
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+#include "hash-string.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions.  This is required by the standard
+   because some ANSI C functions will require linking with this object
+   file and the name space must not be polluted.  */
+# define getcwd __getcwd
+# ifndef stpcpy
+#  define stpcpy __stpcpy
+# endif
+#else
+# if !defined HAVE_GETCWD
+char *getwd ();
+#  define getcwd(buf, max) getwd (buf)
+# else
+char *getcwd ();
+# endif
+# ifndef HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+# endif
+#endif
+
+/* Amount to increase buffer size by in each try.  */
+#define PATH_INCR 32
+
+/* The following is from pathmax.h.  */
+/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
+   PATH_MAX but might cause redefinition warnings when sys/param.h is
+   later included (as on MORE/BSD 4.3).  */
+#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
+# include <limits.h>
+#endif
+
+#ifndef _POSIX_PATH_MAX
+# define _POSIX_PATH_MAX 255
+#endif
+
+#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
+# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
+#endif
+
+/* Don't include sys/param.h if it already has been.  */
+#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
+# include <sys/param.h>
+#endif
+
+#if !defined(PATH_MAX) && defined(MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+#endif
+
+#ifndef PATH_MAX
+# define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+/* XPG3 defines the result of `setlocale (category, NULL)' as:
+   ``Directs `setlocale()' to query `category' and return the current
+     setting of `local'.''
+   However it does not specify the exact format.  And even worse: POSIX
+   defines this not at all.  So we can use this feature only on selected
+   system (e.g. those using GNU C Library).  */
+#ifdef _LIBC
+# define HAVE_LOCALE_NULL
+#endif
+
+/* Name of the default domain used for gettext(3) prior any call to
+   textdomain(3).  The default value for this is "messages".  */
+const char _nl_default_default_domain[] = "messages";
+
+/* Value used as the default domain for gettext(3).  */
+const char *_nl_current_default_domain = _nl_default_default_domain;
+
+/* Contains the default location of the message catalogs.  */
+const char _nl_default_dirname[] = GNULOCALEDIR;
+
+/* List with bindings of specific domains created by bindtextdomain()
+   calls.  */
+struct binding *_nl_domain_bindings;
+
+/* Prototypes for local functions.  */
+static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
+			       const char *msgid)) internal_function;
+static const char *category_to_name PARAMS ((int category)) internal_function;
+static const char *guess_category_value PARAMS ((int category,
+						 const char *categoryname))
+     internal_function;
+
+
+/* For those loosing systems which don't have `alloca' we have to add
+   some additional code emulating it.  */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done.  */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+  void *address;
+  struct block_list *next;
+};
+# define ADD_BLOCK(list, addr)						      \
+  do {									      \
+    struct block_list *newp = (struct block_list *) malloc (sizeof (*newp));  \
+    /* If we cannot get a free block we cannot add the new element to	      \
+       the list.  */							      \
+    if (newp != NULL) {							      \
+      newp->address = (addr);						      \
+      newp->next = (list);						      \
+      (list) = newp;							      \
+    }									      \
+  } while (0)
+# define FREE_BLOCKS(list)						      \
+  do {									      \
+    while (list != NULL) {						      \
+      struct block_list *old = list;					      \
+      list = list->next;						      \
+      free (old);							      \
+    }									      \
+  } while (0)
+# undef alloca
+# define alloca(size) (malloc (size))
+#endif	/* have alloca */
+
+
+/* Names for the libintl functions are a problem.  They must not clash
+   with existing names and they should follow ANSI C.  But this source
+   code is also used in GNU C Library where the names have a __
+   prefix.  So we have to make a difference here.  */
+#ifdef _LIBC
+# define DCGETTEXT __dcgettext
+#else
+# define DCGETTEXT dcgettext__
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+char *
+DCGETTEXT (domainname, msgid, category)
+     const char *domainname;
+     const char *msgid;
+     int category;
+{
+#ifndef HAVE_ALLOCA
+  struct block_list *block_list = NULL;
+#endif
+  struct loaded_l10nfile *domain;
+  struct binding *binding;
+  const char *categoryname;
+  const char *categoryvalue;
+  char *dirname, *xdomainname;
+  char *single_locale;
+  char *retval;
+  int saved_errno = errno;
+
+  /* If no real MSGID is given return NULL.  */
+  if (msgid == NULL)
+    return NULL;
+
+  /* If DOMAINNAME is NULL, we are interested in the default domain.  If
+     CATEGORY is not LC_MESSAGES this might not make much sense but the
+     defintion left this undefined.  */
+  if (domainname == NULL)
+    domainname = _nl_current_default_domain;
+
+  /* First find matching binding.  */
+  for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+    {
+      int compare = strcmp (domainname, binding->domainname);
+      if (compare == 0)
+	/* We found it!  */
+	break;
+      if (compare < 0)
+	{
+	  /* It is not in the list.  */
+	  binding = NULL;
+	  break;
+	}
+    }
+
+  if (binding == NULL)
+    dirname = (char *) _nl_default_dirname;
+  else if (binding->dirname[0] == '/')
+    dirname = binding->dirname;
+  else
+    {
+      /* We have a relative path.  Make it absolute now.  */
+      size_t dirname_len = strlen (binding->dirname) + 1;
+      size_t path_max;
+      char *ret;
+
+      path_max = (unsigned) PATH_MAX;
+      path_max += 2;		/* The getcwd docs say to do this.  */
+
+      dirname = (char *) alloca (path_max + dirname_len);
+      ADD_BLOCK (block_list, dirname);
+
+      __set_errno (0);
+      while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
+	{
+	  path_max += PATH_INCR;
+	  dirname = (char *) alloca (path_max + dirname_len);
+	  ADD_BLOCK (block_list, dirname);
+	  __set_errno (0);
+	}
+
+      if (ret == NULL)
+	{
+	  /* We cannot get the current working directory.  Don't signal an
+	     error but simply return the default string.  */
+	  FREE_BLOCKS (block_list);
+	  __set_errno (saved_errno);
+	  return (char *) msgid;
+	}
+
+      stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
+    }
+
+  /* Now determine the symbolic name of CATEGORY and its value.  */
+  categoryname = category_to_name (category);
+  categoryvalue = guess_category_value (category, categoryname);
+
+  xdomainname = (char *) alloca (strlen (categoryname)
+				 + strlen (domainname) + 5);
+  ADD_BLOCK (block_list, xdomainname);
+
+  stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
+		  domainname),
+	  ".mo");
+
+  /* Creating working area.  */
+  single_locale = (char *) alloca (strlen (categoryvalue) + 1);
+  ADD_BLOCK (block_list, single_locale);
+
+
+  /* Search for the given string.  This is a loop because we perhaps
+     got an ordered list of languages to consider for th translation.  */
+  while (1)
+    {
+      /* Make CATEGORYVALUE point to the next element of the list.  */
+      while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
+	++categoryvalue;
+      if (categoryvalue[0] == '\0')
+	{
+	  /* The whole contents of CATEGORYVALUE has been searched but
+	     no valid entry has been found.  We solve this situation
+	     by implicitly appending a "C" entry, i.e. no translation
+	     will take place.  */
+	  single_locale[0] = 'C';
+	  single_locale[1] = '\0';
+	}
+      else
+	{
+	  char *cp = single_locale;
+	  while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
+	    *cp++ = *categoryvalue++;
+	  *cp = '\0';
+	}
+
+      /* If the current locale value is C (or POSIX) we don't load a
+	 domain.  Return the MSGID.  */
+      if (strcmp (single_locale, "C") == 0
+	  || strcmp (single_locale, "POSIX") == 0)
+	{
+	  FREE_BLOCKS (block_list);
+	  __set_errno (saved_errno);
+	  return (char *) msgid;
+	}
+
+
+      /* Find structure describing the message catalog matching the
+	 DOMAINNAME and CATEGORY.  */
+      domain = _nl_find_domain (dirname, single_locale, xdomainname);
+
+      if (domain != NULL)
+	{
+	  retval = find_msg (domain, msgid);
+
+	  if (retval == NULL)
+	    {
+	      int cnt;
+
+	      for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
+		{
+		  retval = find_msg (domain->successor[cnt], msgid);
+
+		  if (retval != NULL)
+		    break;
+		}
+	    }
+
+	  if (retval != NULL)
+	    {
+	      FREE_BLOCKS (block_list);
+	      __set_errno (saved_errno);
+	      return retval;
+	    }
+	}
+    }
+  /* NOTREACHED */
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library.  */
+weak_alias (__dcgettext, dcgettext);
+#endif
+
+
+static char *
+internal_function
+find_msg (domain_file, msgid)
+     struct loaded_l10nfile *domain_file;
+     const char *msgid;
+{
+  size_t top, act, bottom;
+  struct loaded_domain *domain;
+
+  if (domain_file->decided == 0)
+    _nl_load_domain (domain_file);
+
+  if (domain_file->data == NULL)
+    return NULL;
+
+  domain = (struct loaded_domain *) domain_file->data;
+
+  /* Locate the MSGID and its translation.  */
+  if (domain->hash_size > 2 && domain->hash_tab != NULL)
+    {
+      /* Use the hashing table.  */
+      nls_uint32 len = strlen (msgid);
+      nls_uint32 hash_val = hash_string (msgid);
+      nls_uint32 idx = hash_val % domain->hash_size;
+      nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
+      nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
+
+      if (nstr == 0)
+	/* Hash table entry is empty.  */
+	return NULL;
+
+      if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+	  && strcmp (msgid,
+		     domain->data + W (domain->must_swap,
+				       domain->orig_tab[nstr - 1].offset)) == 0)
+	return (char *) domain->data + W (domain->must_swap,
+					  domain->trans_tab[nstr - 1].offset);
+
+      while (1)
+	{
+	  if (idx >= domain->hash_size - incr)
+	    idx -= domain->hash_size - incr;
+	  else
+	    idx += incr;
+
+	  nstr = W (domain->must_swap, domain->hash_tab[idx]);
+	  if (nstr == 0)
+	    /* Hash table entry is empty.  */
+	    return NULL;
+
+	  if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+	      && strcmp (msgid,
+			 domain->data + W (domain->must_swap,
+					   domain->orig_tab[nstr - 1].offset))
+	         == 0)
+	    return (char *) domain->data
+	      + W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
+	}
+      /* NOTREACHED */
+    }
+
+  /* Now we try the default method:  binary search in the sorted
+     array of messages.  */
+  bottom = 0;
+  top = domain->nstrings;
+  while (bottom < top)
+    {
+      int cmp_val;
+
+      act = (bottom + top) / 2;
+      cmp_val = strcmp (msgid, domain->data
+			       + W (domain->must_swap,
+				    domain->orig_tab[act].offset));
+      if (cmp_val < 0)
+	top = act;
+      else if (cmp_val > 0)
+	bottom = act + 1;
+      else
+	break;
+    }
+
+  /* If an translation is found return this.  */
+  return bottom >= top ? NULL : (char *) domain->data
+                                + W (domain->must_swap,
+				     domain->trans_tab[act].offset);
+}
+
+
+/* Return string representation of locale CATEGORY.  */
+static const char *
+internal_function
+category_to_name (category)
+     int category;
+{
+  const char *retval;
+
+  switch (category)
+  {
+#ifdef LC_COLLATE
+  case LC_COLLATE:
+    retval = "LC_COLLATE";
+    break;
+#endif
+#ifdef LC_CTYPE
+  case LC_CTYPE:
+    retval = "LC_CTYPE";
+    break;
+#endif
+#ifdef LC_MONETARY
+  case LC_MONETARY:
+    retval = "LC_MONETARY";
+    break;
+#endif
+#ifdef LC_NUMERIC
+  case LC_NUMERIC:
+    retval = "LC_NUMERIC";
+    break;
+#endif
+#ifdef LC_TIME
+  case LC_TIME:
+    retval = "LC_TIME";
+    break;
+#endif
+#ifdef LC_MESSAGES
+  case LC_MESSAGES:
+    retval = "LC_MESSAGES";
+    break;
+#endif
+#ifdef LC_RESPONSE
+  case LC_RESPONSE:
+    retval = "LC_RESPONSE";
+    break;
+#endif
+#ifdef LC_ALL
+  case LC_ALL:
+    /* This might not make sense but is perhaps better than any other
+       value.  */
+    retval = "LC_ALL";
+    break;
+#endif
+  default:
+    /* If you have a better idea for a default value let me know.  */
+    retval = "LC_XXX";
+  }
+
+  return retval;
+}
+
+/* Guess value of current locale from value of the environment variables.  */
+static const char *
+internal_function
+guess_category_value (category, categoryname)
+     int category;
+     const char *categoryname;
+{
+  const char *retval;
+
+  /* The highest priority value is the `LANGUAGE' environment
+     variable.  This is a GNU extension.  */
+  retval = getenv ("LANGUAGE");
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+
+  /* `LANGUAGE' is not set.  So we have to proceed with the POSIX
+     methods of looking to `LC_ALL', `LC_xxx', and `LANG'.  On some
+     systems this can be done by the `setlocale' function itself.  */
+#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
+  return setlocale (category, NULL);
+#else
+  /* Setting of LC_ALL overwrites all other.  */
+  retval = getenv ("LC_ALL");
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+
+  /* Next comes the name of the desired category.  */
+  retval = getenv (categoryname);
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+
+  /* Last possibility is the LANG environment variable.  */
+  retval = getenv ("LANG");
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+
+  /* We use C as the default domain.  POSIX says this is implementation
+     defined.  */
+  return "C";
+#endif
+}
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library.  So we
+   avoid the non-standard function stpcpy.  In GNU C Library this
+   function is available, though.  Also allow the symbol HAVE_STPCPY
+   to be defined.  */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+     char *dest;
+     const char *src;
+{
+  while ((*dest++ = *src++) != '\0')
+    /* Do nothing. */ ;
+  return dest - 1;
+}
+#endif
+
+
+#ifdef _LIBC
+/* If we want to free all resources we have to do some work at
+   program's end.  */
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  struct binding *runp;
+
+  for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
+    {
+      free (runp->domainname);
+      if (runp->dirname != _nl_default_dirname)
+	/* Yes, this is a pointer comparison.  */
+	free (runp->dirname);
+    }
+
+  if (_nl_current_default_domain != _nl_default_default_domain)
+    /* Yes, again a pointer comparison.  */
+    free ((char *) _nl_current_default_domain);
+}
+
+text_set_element (__libc_subfreeres, free_mem);
+#endif
diff --git a/intl/dgettext.c b/intl/dgettext.c
new file mode 100644
index 0000000..0510c2b
--- /dev/null
+++ b/intl/dgettext.c
@@ -0,0 +1,59 @@
+/* Implementation of the dgettext(3) function
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined HAVE_LOCALE_H || defined _LIBC
+# include <locale.h>
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Names for the libintl functions are a problem.  They must not clash
+   with existing names and they should follow ANSI C.  But this source
+   code is also used in GNU C Library where the names have a __
+   prefix.  So we have to make a difference here.  */
+#ifdef _LIBC
+# define DGETTEXT __dgettext
+# define DCGETTEXT __dcgettext
+#else
+# define DGETTEXT dgettext__
+# define DCGETTEXT dcgettext__
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog of the current
+   LC_MESSAGES locale.  */
+char *
+DGETTEXT (domainname, msgid)
+     const char *domainname;
+     const char *msgid;
+{
+  return DCGETTEXT (domainname, msgid, LC_MESSAGES);
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library.  */
+weak_alias (__dgettext, dgettext);
+#endif
diff --git a/intl/explodename.c b/intl/explodename.c
new file mode 100644
index 0000000..8066dc2
--- /dev/null
+++ b/intl/explodename.c
@@ -0,0 +1,188 @@
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+#include <sys/types.h>
+
+#include "loadinfo.h"
+
+/* On some strange systems still no definition of NULL is found.  Sigh!  */
+#ifndef NULL
+# if defined __STDC__ && __STDC__
+#  define NULL ((void *) 0)
+# else
+#  define NULL 0
+# endif
+#endif
+
+/* @@ end of prolog @@ */
+
+int
+_nl_explode_name (name, language, modifier, territory, codeset,
+		  normalized_codeset, special, sponsor, revision)
+     char *name;
+     const char **language;
+     const char **modifier;
+     const char **territory;
+     const char **codeset;
+     const char **normalized_codeset;
+     const char **special;
+     const char **sponsor;
+     const char **revision;
+{
+  enum { undecided, xpg, cen } syntax;
+  char *cp;
+  int mask;
+
+  *modifier = NULL;
+  *territory = NULL;
+  *codeset = NULL;
+  *normalized_codeset = NULL;
+  *special = NULL;
+  *sponsor = NULL;
+  *revision = NULL;
+
+  /* Now we determine the single parts of the locale name.  First
+     look for the language.  Termination symbols are `_' and `@' if
+     we use XPG4 style, and `_', `+', and `,' if we use CEN syntax.  */
+  mask = 0;
+  syntax = undecided;
+  *language = cp = name;
+  while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@'
+	 && cp[0] != '+' && cp[0] != ',')
+    ++cp;
+
+  if (*language == cp)
+    /* This does not make sense: language has to be specified.  Use
+       this entry as it is without exploding.  Perhaps it is an alias.  */
+    cp = strchr (*language, '\0');
+  else if (cp[0] == '_')
+    {
+      /* Next is the territory.  */
+      cp[0] = '\0';
+      *territory = ++cp;
+
+      while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
+	     && cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
+	++cp;
+
+      mask |= TERRITORY;
+
+      if (cp[0] == '.')
+	{
+	  /* Next is the codeset.  */
+	  syntax = xpg;
+	  cp[0] = '\0';
+	  *codeset = ++cp;
+
+	  while (cp[0] != '\0' && cp[0] != '@')
+	    ++cp;
+
+	  mask |= XPG_CODESET;
+
+	  if (*codeset != cp && (*codeset)[0] != '\0')
+	    {
+	      *normalized_codeset = _nl_normalize_codeset (*codeset,
+							   cp - *codeset);
+	      if (strcmp (*codeset, *normalized_codeset) == 0)
+		free ((char *) *normalized_codeset);
+	      else
+		mask |= XPG_NORM_CODESET;
+	    }
+	}
+    }
+
+  if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
+    {
+      /* Next is the modifier.  */
+      syntax = cp[0] == '@' ? xpg : cen;
+      cp[0] = '\0';
+      *modifier = ++cp;
+
+      while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
+	     && cp[0] != ',' && cp[0] != '_')
+	++cp;
+
+      mask |= XPG_MODIFIER | CEN_AUDIENCE;
+    }
+
+  if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
+    {
+      syntax = cen;
+
+      if (cp[0] == '+')
+	{
+ 	  /* Next is special application (CEN syntax).  */
+	  cp[0] = '\0';
+	  *special = ++cp;
+
+	  while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
+	    ++cp;
+
+	  mask |= CEN_SPECIAL;
+	}
+
+      if (cp[0] == ',')
+	{
+ 	  /* Next is sponsor (CEN syntax).  */
+	  cp[0] = '\0';
+	  *sponsor = ++cp;
+
+	  while (cp[0] != '\0' && cp[0] != '_')
+	    ++cp;
+
+	  mask |= CEN_SPONSOR;
+	}
+
+      if (cp[0] == '_')
+	{
+ 	  /* Next is revision (CEN syntax).  */
+	  cp[0] = '\0';
+	  *revision = ++cp;
+
+	  mask |= CEN_REVISION;
+	}
+    }
+
+  /* For CEN syntax values it might be important to have the
+     separator character in the file name, not for XPG syntax.  */
+  if (syntax == xpg)
+    {
+      if (*territory != NULL && (*territory)[0] == '\0')
+	mask &= ~TERRITORY;
+
+      if (*codeset != NULL && (*codeset)[0] == '\0')
+	mask &= ~XPG_CODESET;
+
+      if (*modifier != NULL && (*modifier)[0] == '\0')
+	mask &= ~XPG_MODIFIER;
+    }
+
+  return mask;
+}
diff --git a/intl/finddomain.c b/intl/finddomain.c
new file mode 100644
index 0000000..81ea29b
--- /dev/null
+++ b/intl/finddomain.c
@@ -0,0 +1,216 @@
+/* Handle list of needed message catalogs
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+# ifdef HAVE_MALLOC_H
+#  include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+#  define strchr index
+# endif
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+/* List of already loaded domains.  */
+static struct loaded_l10nfile *_nl_loaded_domains;
+
+
+/* Return a data structure describing the message catalog described by
+   the DOMAINNAME and CATEGORY parameters with respect to the currently
+   established bindings.  */
+struct loaded_l10nfile *
+internal_function
+_nl_find_domain (dirname, locale, domainname)
+     const char *dirname;
+     char *locale;
+     const char *domainname;
+{
+  struct loaded_l10nfile *retval;
+  const char *language;
+  const char *modifier;
+  const char *territory;
+  const char *codeset;
+  const char *normalized_codeset;
+  const char *special;
+  const char *sponsor;
+  const char *revision;
+  const char *alias_value;
+  int mask;
+
+  /* LOCALE can consist of up to four recognized parts for the XPG syntax:
+
+		language[_territory[.codeset]][@modifier]
+
+     and six parts for the CEN syntax:
+
+	language[_territory][+audience][+special][,[sponsor][_revision]]
+
+     Beside the first part all of them are allowed to be missing.  If
+     the full specified locale is not found, the less specific one are
+     looked for.  The various parts will be stripped off according to
+     the following order:
+		(1) revision
+		(2) sponsor
+		(3) special
+		(4) codeset
+		(5) normalized codeset
+		(6) territory
+		(7) audience/modifier
+   */
+
+  /* If we have already tested for this locale entry there has to
+     be one data set in the list of loaded domains.  */
+  retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
+			       strlen (dirname) + 1, 0, locale, NULL, NULL,
+			       NULL, NULL, NULL, NULL, NULL, domainname, 0);
+  if (retval != NULL)
+    {
+      /* We know something about this locale.  */
+      int cnt;
+
+      if (retval->decided == 0)
+	_nl_load_domain (retval);
+
+      if (retval->data != NULL)
+	return retval;
+
+      for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+	{
+	  if (retval->successor[cnt]->decided == 0)
+	    _nl_load_domain (retval->successor[cnt]);
+
+	  if (retval->successor[cnt]->data != NULL)
+	    break;
+	}
+      return cnt >= 0 ? retval : NULL;
+      /* NOTREACHED */
+    }
+
+  /* See whether the locale value is an alias.  If yes its value
+     *overwrites* the alias name.  No test for the original value is
+     done.  */
+  alias_value = _nl_expand_alias (locale);
+  if (alias_value != NULL)
+    {
+#if defined _LIBC || defined HAVE_STRDUP
+      locale = strdup (alias_value);
+      if (locale == NULL)
+	return NULL;
+#else
+      size_t len = strlen (alias_value) + 1;
+      locale = (char *) malloc (len);
+      if (locale == NULL)
+	return NULL;
+
+      memcpy (locale, alias_value, len);
+#endif
+    }
+
+  /* Now we determine the single parts of the locale name.  First
+     look for the language.  Termination symbols are `_' and `@' if
+     we use XPG4 style, and `_', `+', and `,' if we use CEN syntax.  */
+  mask = _nl_explode_name (locale, &language, &modifier, &territory,
+			   &codeset, &normalized_codeset, &special,
+			   &sponsor, &revision);
+
+  /* Create all possible locale entries which might be interested in
+     generalization.  */
+  retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
+			       strlen (dirname) + 1, mask, language, territory,
+			       codeset, normalized_codeset, modifier, special,
+			       sponsor, revision, domainname, 1);
+  if (retval == NULL)
+    /* This means we are out of core.  */
+    return NULL;
+
+  if (retval->decided == 0)
+    _nl_load_domain (retval);
+  if (retval->data == NULL)
+    {
+      int cnt;
+      for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+	{
+	  if (retval->successor[cnt]->decided == 0)
+	    _nl_load_domain (retval->successor[cnt]);
+	  if (retval->successor[cnt]->data != NULL)
+	    break;
+	}
+    }
+
+  /* The room for an alias was dynamically allocated.  Free it now.  */
+  if (alias_value != NULL)
+    free (locale);
+
+  return retval;
+}
+
+
+#ifdef _LIBC
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  struct loaded_l10nfile *runp = _nl_loaded_domains;
+
+  while (runp != NULL)
+    {
+      struct loaded_l10nfile *here = runp;
+      if (runp->data != NULL)
+	_nl_unload_domain ((struct loaded_domain *) runp->data);
+      runp = runp->next;
+      free (here);
+    }
+}
+
+text_set_element (__libc_subfreeres, free_mem);
+#endif
diff --git a/intl/gettext.c b/intl/gettext.c
new file mode 100644
index 0000000..d929f98
--- /dev/null
+++ b/intl/gettext.c
@@ -0,0 +1,70 @@
+/* Implementation of gettext(3) function.
+   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define __need_NULL
+# include <stddef.h>
+#else
+# ifdef STDC_HEADERS
+#  include <stdlib.h>		/* Just for NULL.  */
+# else
+#  ifdef HAVE_STRING_H
+#   include <string.h>
+#  else
+#   define NULL ((void *) 0)
+#  endif
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Names for the libintl functions are a problem.  They must not clash
+   with existing names and they should follow ANSI C.  But this source
+   code is also used in GNU C Library where the names have a __
+   prefix.  So we have to make a difference here.  */
+#ifdef _LIBC
+# define GETTEXT __gettext
+# define DGETTEXT __dgettext
+#else
+# define GETTEXT gettext__
+# define DGETTEXT dgettext__
+#endif
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+char *
+GETTEXT (msgid)
+     const char *msgid;
+{
+  return DGETTEXT (NULL, msgid);
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library.  */
+weak_alias (__gettext, gettext);
+#endif
diff --git a/intl/gettext.h b/intl/gettext.h
new file mode 100644
index 0000000..3cd23d7
--- /dev/null
+++ b/intl/gettext.h
@@ -0,0 +1,105 @@
+/* Internal header for GNU gettext internationalization functions.
+   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _GETTEXT_H
+#define _GETTEXT_H 1
+
+#include <stdio.h>
+
+#if HAVE_LIMITS_H || _LIBC
+# include <limits.h>
+#endif
+
+/* @@ end of prolog @@ */
+
+/* The magic number of the GNU message catalog format.  */
+#define _MAGIC 0x950412de
+#define _MAGIC_SWAPPED 0xde120495
+
+/* Revision number of the currently used .mo (binary) file format.  */
+#define MO_REVISION_NUMBER 0
+
+/* The following contortions are an attempt to use the C preprocessor
+   to determine an unsigned integral type that is 32 bits wide.  An
+   alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+   doing that would require that the configure script compile and *run*
+   the resulting executable.  Locally running cross-compiled executables
+   is usually not possible.  */
+
+#if __STDC__
+# define UINT_MAX_32_BITS 4294967295U
+#else
+# define UINT_MAX_32_BITS 0xFFFFFFFF
+#endif
+
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+   This should be valid for all systems GNU cares about because
+   that doesn't include 16-bit systems, and only modern systems
+   (that certainly have <limits.h>) have 64+-bit integral types.  */
+
+#ifndef UINT_MAX
+# define UINT_MAX UINT_MAX_32_BITS
+#endif
+
+#if UINT_MAX == UINT_MAX_32_BITS
+typedef unsigned nls_uint32;
+#else
+# if USHRT_MAX == UINT_MAX_32_BITS
+typedef unsigned short nls_uint32;
+# else
+#  if ULONG_MAX == UINT_MAX_32_BITS
+typedef unsigned long nls_uint32;
+#  else
+  /* The following line is intended to throw an error.  Using #error is
+     not portable enough.  */
+  "Cannot determine unsigned 32-bit data type."
+#  endif
+# endif
+#endif
+
+
+/* Header for binary .mo file format.  */
+struct mo_file_header
+{
+  /* The magic number.  */
+  nls_uint32 magic;
+  /* The revision number of the file format.  */
+  nls_uint32 revision;
+  /* The number of strings pairs.  */
+  nls_uint32 nstrings;
+  /* Offset of table with start offsets of original strings.  */
+  nls_uint32 orig_tab_offset;
+  /* Offset of table with start offsets of translation strings.  */
+  nls_uint32 trans_tab_offset;
+  /* Size of hashing table.  */
+  nls_uint32 hash_tab_size;
+  /* Offset of first hashing entry.  */
+  nls_uint32 hash_tab_offset;
+};
+
+struct string_desc
+{
+  /* Length of addressed string.  */
+  nls_uint32 length;
+  /* Offset of string in file.  */
+  nls_uint32 offset;
+};
+
+/* @@ begin of epilog @@ */
+
+#endif	/* gettext.h  */
diff --git a/intl/gettextP.h b/intl/gettextP.h
new file mode 100644
index 0000000..00c5203
--- /dev/null
+++ b/intl/gettextP.h
@@ -0,0 +1,89 @@
+/* Header describing internals of gettext library
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _GETTEXTP_H
+#define _GETTEXTP_H
+
+#include "loadinfo.h"
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__
+#  define PARAMS(args) args
+# else
+#  define PARAMS(args) ()
+# endif
+#endif
+
+#ifndef internal_function
+# define internal_function
+#endif
+
+#ifndef W
+# define W(flag, data) ((flag) ? SWAP (data) : (data))
+#endif
+
+
+#ifdef _LIBC
+# include <byteswap.h>
+# define SWAP(i) bswap_32 (i)
+#else
+static nls_uint32 SWAP PARAMS ((nls_uint32 i));
+
+static inline nls_uint32
+SWAP (i)
+     nls_uint32 i;
+{
+  return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
+}
+#endif
+
+
+struct loaded_domain
+{
+  const char *data;
+  int use_mmap;
+  size_t mmap_size;
+  int must_swap;
+  nls_uint32 nstrings;
+  struct string_desc *orig_tab;
+  struct string_desc *trans_tab;
+  nls_uint32 hash_size;
+  nls_uint32 *hash_tab;
+};
+
+struct binding
+{
+  struct binding *next;
+  char *domainname;
+  char *dirname;
+};
+
+struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
+						 char *__locale,
+						 const char *__domainname))
+     internal_function;
+void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
+     internal_function;
+void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
+     internal_function;
+
+/* @@ begin of epilog @@ */
+
+#endif /* gettextP.h  */
diff --git a/intl/hash-string.h b/intl/hash-string.h
new file mode 100644
index 0000000..cacb38e
--- /dev/null
+++ b/intl/hash-string.h
@@ -0,0 +1,59 @@
+/* Implements a string hashing function.
+   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+#endif
+
+/* We assume to have `unsigned long int' value with at least 32 bits.  */
+#define HASHWORDBITS 32
+
+
+/* Defines the so called `hashpjw' function by P.J. Weinberger
+   [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+   1986, 1987 Bell Telephone Laboratories, Inc.]  */
+static unsigned long hash_string PARAMS ((const char *__str_param));
+
+static inline unsigned long
+hash_string (str_param)
+     const char *str_param;
+{
+  unsigned long int hval, g;
+  const char *str = str_param;
+
+  /* Compute the hash value for the given string.  */
+  hval = 0;
+  while (*str != '\0')
+    {
+      hval <<= 4;
+      hval += (unsigned long) *str++;
+      g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
+      if (g != 0)
+	{
+	  hval ^= g >> (HASHWORDBITS - 8);
+	  hval ^= g;
+	}
+    }
+  return hval;
+}
diff --git a/intl/intl-compat.c b/intl/intl-compat.c
new file mode 100644
index 0000000..503efa0
--- /dev/null
+++ b/intl/intl-compat.c
@@ -0,0 +1,76 @@
+/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
+   Library.
+   Copyright (C) 1995 Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libgettext.h"
+
+/* @@ end of prolog @@ */
+
+
+#undef gettext
+#undef dgettext
+#undef dcgettext
+#undef textdomain
+#undef bindtextdomain
+
+
+char *
+bindtextdomain (domainname, dirname)
+     const char *domainname;
+     const char *dirname;
+{
+  return bindtextdomain__ (domainname, dirname);
+}
+
+
+char *
+dcgettext (domainname, msgid, category)
+     const char *domainname;
+     const char *msgid;
+     int category;
+{
+  return dcgettext__ (domainname, msgid, category);
+}
+
+
+char *
+dgettext (domainname, msgid)
+     const char *domainname;
+     const char *msgid;
+{
+  return dgettext__ (domainname, msgid);
+}
+
+
+char *
+gettext (msgid)
+     const char *msgid;
+{
+  return gettext__ (msgid);
+}
+
+
+char *
+textdomain (domainname)
+     const char *domainname;
+{
+  return textdomain__ (domainname);
+}
diff --git a/intl/intlh.inst.in b/intl/intlh.inst.in
new file mode 100644
index 0000000..27cf6c7
--- /dev/null
+++ b/intl/intlh.inst.in
@@ -0,0 +1,111 @@
+/* Message catalogs for internationalization.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.  */
+
+#ifndef _LIBINTL_H
+#define _LIBINTL_H	1
+
+@INCLUDE_LOCALE_H@
+
+/* We define an additional symbol to signal that we use the GNU
+   implementation of gettext.  */
+#define __USE_GNU_GETTEXT 1
+
+#ifndef PARAMS
+# if __STDC__ || defined __cplusplus
+#  define PARAMS(args) args
+# else
+#  define PARAMS(args) ()
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+extern char *gettext PARAMS ((const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+   LC_MESSAGES locale.  */
+extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
+				int __category));
+
+
+/* Set the current default message catalog to DOMAINNAME.
+   If DOMAINNAME is null, return the current default.
+   If DOMAINNAME is "", reset to the default of "messages".  */
+extern char *textdomain PARAMS ((const char *__domainname));
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+extern char *bindtextdomain PARAMS ((const char *__domainname,
+				     const char *__dirname));
+
+
+/* Optimized version of the functions above.  */
+#if defined __OPTIMIZED
+/* These must be a macro.  Inlined functions are useless because the
+   `__builtin_constant_p' predicate in dcgettext would always return
+   false.  */
+
+# define gettext(msgid) dgettext ((char *) 0, msgid)
+
+# define dgettext(domainname, msgid)					      \
+  dcgettext (domainname, msgid, LC_MESSAGES)
+
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+/* This global variable is defined in loadmsgcat.c.  We need a sign,
+   whether a new catalog was loaded, which can be associated with all
+   translations.  */
+extern int _nl_msg_cat_cntr;
+
+#  define dcgettext(domainname, msgid, category)			      \
+  (__extension__							      \
+   ({									      \
+     char *__result;							      \
+     if (__builtin_constant_p (msgid))					      \
+       {								      \
+	 static char *__translation__;					      \
+	 static int __catalog_counter__;				      \
+	 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr)    \
+	   {								      \
+	     __translation__ =						      \
+	       (dcgettext) ((domainname), (msgid), (category));		      \
+	     __catalog_counter__ = _nl_msg_cat_cntr;			      \
+	   }								      \
+	 __result = __translation__;					      \
+       }								      \
+     else								      \
+       __result = (dcgettext) ((domainname), (msgid), (category));	      \
+     __result;								      \
+    }))
+# endif
+#endif /* Optimizing. */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* libintl.h */
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
new file mode 100644
index 0000000..9c7dc18
--- /dev/null
+++ b/intl/l10nflist.c
@@ -0,0 +1,411 @@
+/* Handle list of needed message catalogs
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+#  define _GNU_SOURCE	1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+#  define strchr index
+# endif
+#endif
+
+#if defined _LIBC || defined HAVE_ARGZ_H
+# include <argz.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#include "loadinfo.h"
+
+/* On some strange systems still no definition of NULL is found.  Sigh!  */
+#ifndef NULL
+# if defined __STDC__ && __STDC__
+#  define NULL ((void *) 0)
+# else
+#  define NULL 0
+# endif
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions.  This is required by the standard
+   because some ANSI C functions will require linking with this object
+   file and the name space must not be polluted.  */
+# ifndef stpcpy
+#  define stpcpy(dest, src) __stpcpy(dest, src)
+# endif
+#else
+# ifndef HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+# endif
+#endif
+
+/* Define function which are usually not available.  */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
+/* Returns the number of strings in ARGZ.  */
+static size_t argz_count__ PARAMS ((const char *argz, size_t len));
+
+static size_t
+argz_count__ (argz, len)
+     const char *argz;
+     size_t len;
+{
+  size_t count = 0;
+  while (len > 0)
+    {
+      size_t part_len = strlen (argz);
+      argz += part_len + 1;
+      len -= part_len + 1;
+      count++;
+    }
+  return count;
+}
+# undef __argz_count
+# define __argz_count(argz, len) argz_count__ (argz, len)
+#endif	/* !_LIBC && !HAVE___ARGZ_COUNT */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
+/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
+   except the last into the character SEP.  */
+static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
+
+static void
+argz_stringify__ (argz, len, sep)
+     char *argz;
+     size_t len;
+     int sep;
+{
+  while (len > 0)
+    {
+      size_t part_len = strlen (argz);
+      argz += part_len;
+      len -= part_len + 1;
+      if (len > 0)
+	*argz++ = sep;
+    }
+}
+# undef __argz_stringify
+# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
+#endif	/* !_LIBC && !HAVE___ARGZ_STRINGIFY */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
+static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
+				  const char *entry));
+
+static char *
+argz_next__ (argz, argz_len, entry)
+     char *argz;
+     size_t argz_len;
+     const char *entry;
+{
+  if (entry)
+    {
+      if (entry < argz + argz_len)
+        entry = strchr (entry, '\0') + 1;
+
+      return entry >= argz + argz_len ? NULL : (char *) entry;
+    }
+  else
+    if (argz_len > 0)
+      return argz;
+    else
+      return 0;
+}
+# undef __argz_next
+# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
+#endif	/* !_LIBC && !HAVE___ARGZ_NEXT */
+
+
+/* Return number of bits set in X.  */
+static int pop PARAMS ((int x));
+
+static inline int
+pop (x)
+     int x;
+{
+  /* We assume that no more than 16 bits are used.  */
+  x = ((x & ~0x5555) >> 1) + (x & 0x5555);
+  x = ((x & ~0x3333) >> 2) + (x & 0x3333);
+  x = ((x >> 4) + x) & 0x0f0f;
+  x = ((x >> 8) + x) & 0xff;
+
+  return x;
+}
+
+
+struct loaded_l10nfile *
+_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
+		    territory, codeset, normalized_codeset, modifier, special,
+		    sponsor, revision, filename, do_allocate)
+     struct loaded_l10nfile **l10nfile_list;
+     const char *dirlist;
+     size_t dirlist_len;
+     int mask;
+     const char *language;
+     const char *territory;
+     const char *codeset;
+     const char *normalized_codeset;
+     const char *modifier;
+     const char *special;
+     const char *sponsor;
+     const char *revision;
+     const char *filename;
+     int do_allocate;
+{
+  char *abs_filename;
+  struct loaded_l10nfile *last = NULL;
+  struct loaded_l10nfile *retval;
+  char *cp;
+  size_t entries;
+  int cnt;
+
+  /* Allocate room for the full file name.  */
+  abs_filename = (char *) malloc (dirlist_len
+				  + strlen (language)
+				  + ((mask & TERRITORY) != 0
+				     ? strlen (territory) + 1 : 0)
+				  + ((mask & XPG_CODESET) != 0
+				     ? strlen (codeset) + 1 : 0)
+				  + ((mask & XPG_NORM_CODESET) != 0
+				     ? strlen (normalized_codeset) + 1 : 0)
+				  + (((mask & XPG_MODIFIER) != 0
+				      || (mask & CEN_AUDIENCE) != 0)
+				     ? strlen (modifier) + 1 : 0)
+				  + ((mask & CEN_SPECIAL) != 0
+				     ? strlen (special) + 1 : 0)
+				  + (((mask & CEN_SPONSOR) != 0
+				      || (mask & CEN_REVISION) != 0)
+				     ? (1 + ((mask & CEN_SPONSOR) != 0
+					     ? strlen (sponsor) + 1 : 0)
+					+ ((mask & CEN_REVISION) != 0
+					   ? strlen (revision) + 1 : 0)) : 0)
+				  + 1 + strlen (filename) + 1);
+
+  if (abs_filename == NULL)
+    return NULL;
+
+  retval = NULL;
+  last = NULL;
+
+  /* Construct file name.  */
+  memcpy (abs_filename, dirlist, dirlist_len);
+  __argz_stringify (abs_filename, dirlist_len, ':');
+  cp = abs_filename + (dirlist_len - 1);
+  *cp++ = '/';
+  cp = stpcpy (cp, language);
+
+  if ((mask & TERRITORY) != 0)
+    {
+      *cp++ = '_';
+      cp = stpcpy (cp, territory);
+    }
+  if ((mask & XPG_CODESET) != 0)
+    {
+      *cp++ = '.';
+      cp = stpcpy (cp, codeset);
+    }
+  if ((mask & XPG_NORM_CODESET) != 0)
+    {
+      *cp++ = '.';
+      cp = stpcpy (cp, normalized_codeset);
+    }
+  if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
+    {
+      /* This component can be part of both syntaces but has different
+	 leading characters.  For CEN we use `+', else `@'.  */
+      *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
+      cp = stpcpy (cp, modifier);
+    }
+  if ((mask & CEN_SPECIAL) != 0)
+    {
+      *cp++ = '+';
+      cp = stpcpy (cp, special);
+    }
+  if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
+    {
+      *cp++ = ',';
+      if ((mask & CEN_SPONSOR) != 0)
+	cp = stpcpy (cp, sponsor);
+      if ((mask & CEN_REVISION) != 0)
+	{
+	  *cp++ = '_';
+	  cp = stpcpy (cp, revision);
+	}
+    }
+
+  *cp++ = '/';
+  stpcpy (cp, filename);
+
+  /* Look in list of already loaded domains whether it is already
+     available.  */
+  last = NULL;
+  for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
+    if (retval->filename != NULL)
+      {
+	int compare = strcmp (retval->filename, abs_filename);
+	if (compare == 0)
+	  /* We found it!  */
+	  break;
+	if (compare < 0)
+	  {
+	    /* It's not in the list.  */
+	    retval = NULL;
+	    break;
+	  }
+
+	last = retval;
+      }
+
+  if (retval != NULL || do_allocate == 0)
+    {
+      free (abs_filename);
+      return retval;
+    }
+
+  retval = (struct loaded_l10nfile *)
+    malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
+				* (1 << pop (mask))
+				* sizeof (struct loaded_l10nfile *)));
+  if (retval == NULL)
+    return NULL;
+
+  retval->filename = abs_filename;
+  retval->decided = (__argz_count (dirlist, dirlist_len) != 1
+		     || ((mask & XPG_CODESET) != 0
+			 && (mask & XPG_NORM_CODESET) != 0));
+  retval->data = NULL;
+
+  if (last == NULL)
+    {
+      retval->next = *l10nfile_list;
+      *l10nfile_list = retval;
+    }
+  else
+    {
+      retval->next = last->next;
+      last->next = retval;
+    }
+
+  entries = 0;
+  /* If the DIRLIST is a real list the RETVAL entry corresponds not to
+     a real file.  So we have to use the DIRLIST separation mechanism
+     of the inner loop.  */
+  cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
+  for (; cnt >= 0; --cnt)
+    if ((cnt & ~mask) == 0
+	&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
+	&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
+      {
+	/* Iterate over all elements of the DIRLIST.  */
+	char *dir = NULL;
+
+	while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
+	       != NULL)
+	  retval->successor[entries++]
+	    = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
+				  language, territory, codeset,
+				  normalized_codeset, modifier, special,
+				  sponsor, revision, filename, 1);
+      }
+  retval->successor[entries] = NULL;
+
+  return retval;
+}
+
+/* Normalize codeset name.  There is no standard for the codeset
+   names.  Normalization allows the user to use any of the common
+   names.  */
+const char *
+_nl_normalize_codeset (codeset, name_len)
+     const unsigned char *codeset;
+     size_t name_len;
+{
+  int len = 0;
+  int only_digit = 1;
+  char *retval;
+  char *wp;
+  size_t cnt;
+
+  for (cnt = 0; cnt < name_len; ++cnt)
+    if (isalnum (codeset[cnt]))
+      {
+	++len;
+
+	if (isalpha (codeset[cnt]))
+	  only_digit = 0;
+      }
+
+  retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
+
+  if (retval != NULL)
+    {
+      if (only_digit)
+	wp = stpcpy (retval, "iso");
+      else
+	wp = retval;
+
+      for (cnt = 0; cnt < name_len; ++cnt)
+	if (isalpha (codeset[cnt]))
+	  *wp++ = tolower (codeset[cnt]);
+	else if (isdigit (codeset[cnt]))
+	  *wp++ = codeset[cnt];
+
+      *wp = '\0';
+    }
+
+  return (const char *) retval;
+}
+
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library.  So we
+   avoid the non-standard function stpcpy.  In GNU C Library this
+   function is available, though.  Also allow the symbol HAVE_STPCPY
+   to be defined.  */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+     char *dest;
+     const char *src;
+{
+  while ((*dest++ = *src++) != '\0')
+    /* Do nothing. */ ;
+  return dest - 1;
+}
+#endif
diff --git a/intl/libgettext.h b/intl/libgettext.h
new file mode 100644
index 0000000..3a92960
--- /dev/null
+++ b/intl/libgettext.h
@@ -0,0 +1,182 @@
+/* Message catalogs for internationalization.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Because on some systems (e.g. Solaris) we sometimes have to include
+   the systems libintl.h as well as this file we have more complex
+   include protection above.  But the systems header might perhaps also
+   define _LIBINTL_H and therefore we have to protect the definition here.  */
+
+#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
+#ifndef _LIBINTL_H
+# define _LIBINTL_H	1
+#endif
+#define _LIBGETTEXT_H	1
+
+/* We define an additional symbol to signal that we use the GNU
+   implementation of gettext.  */
+#define __USE_GNU_GETTEXT 1
+
+#include <sys/types.h>
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__ || defined __cplusplus
+#  define PARAMS(args) args
+# else
+#  define PARAMS(args) ()
+# endif
+#endif
+
+#ifndef NULL
+# if !defined __cplusplus || defined __GNUC__
+#  define NULL ((void *) 0)
+# else
+#  define NULL (0)
+# endif
+#endif
+
+#if !HAVE_LC_MESSAGES
+/* This value determines the behaviour of the gettext() and dgettext()
+   function.  But some system does not have this defined.  Define it
+   to a default value.  */
+# define LC_MESSAGES (-1)
+#endif
+
+
+/* Declarations for gettext-using-catgets interface.  Derived from
+   Jim Meyering's libintl.h.  */
+struct _msg_ent
+{
+  const char *_msg;
+  int _msg_number;
+};
+
+
+#if HAVE_CATGETS
+/* These two variables are defined in the automatically by po-to-tbl.sed
+   generated file `cat-id-tbl.c'.  */
+extern const struct _msg_ent _msg_tbl[];
+extern int _msg_tbl_length;
+#endif
+
+
+/* For automatical extraction of messages sometimes no real
+   translation is needed.  Instead the string itself is the result.  */
+#define gettext_noop(Str) (Str)
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+extern char *gettext PARAMS ((const char *__msgid));
+extern char *gettext__ PARAMS ((const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+   LC_MESSAGES locale.  */
+extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
+extern char *dgettext__ PARAMS ((const char *__domainname,
+				 const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
+				int __category));
+extern char *dcgettext__ PARAMS ((const char *__domainname,
+				  const char *__msgid, int __category));
+
+
+/* Set the current default message catalog to DOMAINNAME.
+   If DOMAINNAME is null, return the current default.
+   If DOMAINNAME is "", reset to the default of "messages".  */
+extern char *textdomain PARAMS ((const char *__domainname));
+extern char *textdomain__ PARAMS ((const char *__domainname));
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+extern char *bindtextdomain PARAMS ((const char *__domainname,
+				  const char *__dirname));
+extern char *bindtextdomain__ PARAMS ((const char *__domainname,
+				    const char *__dirname));
+
+#if ENABLE_NLS
+
+/* Solaris 2.3 has the gettext function but dcgettext is missing.
+   So we omit this optimization for Solaris 2.3.  BTW, Solaris 2.4
+   has dcgettext.  */
+# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
+
+#  define gettext(Msgid)						      \
+     dgettext (NULL, Msgid)
+
+#  define dgettext(Domainname, Msgid)					      \
+     dcgettext (Domainname, Msgid, LC_MESSAGES)
+
+#  if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+/* This global variable is defined in loadmsgcat.c.  We need a sign,
+   whether a new catalog was loaded, which can be associated with all
+   translations.  */
+extern int _nl_msg_cat_cntr;
+
+#   define dcgettext(Domainname, Msgid, Category)			      \
+  (__extension__							      \
+   ({									      \
+     char *__result;							      \
+     if (__builtin_constant_p (Msgid))					      \
+       {								      \
+	 static char *__translation__;					      \
+	 static int __catalog_counter__;				      \
+	 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr)    \
+	   {								      \
+	     __translation__ =						      \
+	       dcgettext__ (Domainname, Msgid, Category);		      \
+	     __catalog_counter__ = _nl_msg_cat_cntr;			      \
+	   }								      \
+	 __result = __translation__;					      \
+       }								      \
+     else								      \
+       __result = dcgettext__ (Domainname, Msgid, Category);		      \
+     __result;								      \
+    }))
+#  endif
+# endif
+
+#else
+
+# define gettext(Msgid) (Msgid)
+# define dgettext(Domainname, Msgid) (Msgid)
+# define dcgettext(Domainname, Msgid, Category) (Msgid)
+# define textdomain(Domainname) ((char *) Domainname)
+# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
+
+#endif
+
+/* @@ begin of epilog @@ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/intl/libintl.glibc b/intl/libintl.glibc
new file mode 100644
index 0000000..2c8e8a4
--- /dev/null
+++ b/intl/libintl.glibc
@@ -0,0 +1,120 @@
+/* Message catalogs for internationalization.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+   This file is derived from the file libgettext.h in the GNU gettext package.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _LIBINTL_H
+#define _LIBINTL_H	1
+
+#include <features.h>
+
+/* We define an additional symbol to signal that we use the GNU
+   implementation of gettext.  */
+#define __USE_GNU_GETTEXT 1
+
+__BEGIN_DECLS
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+extern char *gettext __P ((__const char *__msgid));
+extern char *__gettext __P ((__const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+   LC_MESSAGES locale.  */
+extern char *dgettext __P ((__const char *__domainname,
+			    __const char *__msgid));
+extern char *__dgettext __P ((__const char *__domainname,
+			      __const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+extern char *dcgettext __P ((__const char *__domainname,
+			     __const char *__msgid, int __category));
+extern char *__dcgettext __P ((__const char *__domainname,
+			       __const char *__msgid, int __category));
+
+
+/* Set the current default message catalog to DOMAINNAME.
+   If DOMAINNAME is null, return the current default.
+   If DOMAINNAME is "", reset to the default of "messages".  */
+extern char *textdomain __P ((__const char *__domainname));
+extern char *__textdomain __P ((__const char *__domainname));
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+extern char *bindtextdomain __P ((__const char *__domainname,
+				  __const char *__dirname));
+extern char *__bindtextdomain __P ((__const char *__domainname,
+				    __const char *__dirname));
+
+
+/* Optimized version of the function above.  */
+#if defined __OPTIMIZE__
+
+/* We need NULL for `gettext'.  */
+# define __need_NULL
+# include <stddef.h>
+
+/* We need LC_MESSAGES for `dgettext'.  */
+# include <locale.h>
+
+/* These must be macros.  Inlined functions are useless because the
+   `__builtin_constant_p' predicate in dcgettext would always return
+   false.  */
+
+# define gettext(msgid) dgettext (NULL, msgid)
+
+# define dgettext(domainname, msgid)					      \
+  dcgettext (domainname, msgid, LC_MESSAGES)
+
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+/* Variable defined in loadmsgcat.c which gets incremented every time a
+   new catalog is loaded.  */
+extern int _nl_msg_cat_cntr;
+
+#  define dcgettext(domainname, msgid, category)			      \
+  (__extension__							      \
+   ({									      \
+     char *__result;							      \
+     if (__builtin_constant_p (msgid))					      \
+       {								      \
+	 static char *__translation__;					      \
+	 static int __catalog_counter__;				      \
+	 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr)    \
+	   {								      \
+	     __translation__ =						      \
+	       __dcgettext ((domainname), (msgid), (category));		      \
+	     __catalog_counter__ = _nl_msg_cat_cntr;			      \
+	   }								      \
+	 __result = __translation__;					      \
+       }								      \
+     else								      \
+       __result = __dcgettext ((domainname), (msgid), (category));	      \
+     __result;								      \
+    }))
+# endif
+#endif /* Optimizing. */
+
+
+__END_DECLS
+
+#endif /* libintl.h */
diff --git a/intl/linux-msg.sed b/intl/linux-msg.sed
new file mode 100644
index 0000000..6f03912
--- /dev/null
+++ b/intl/linux-msg.sed
@@ -0,0 +1,100 @@
+# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
+# Copyright 1995, 2002 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#
+# The first directive in the .msg should be the definition of the
+# message set number.  We use always set number 1.
+#
+1 {
+  i\
+$set 1 # Automatically created by po2msg.sed
+  h
+  s/.*/0/
+  x
+}
+#
+# Mitch's old catalog format does not allow comments.
+#
+# We copy the original message as a comment into the .msg file.
+#
+/^msgid/ {
+  s/msgid[ 	]*"//
+#
+# This does not work now with the new format.
+# /"$/! {
+#   s/\\$//
+#   s/$/ ... (more lines following)"/
+# }
+  x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+  td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+  :d
+  s/9\(_*\)$/_\1/
+  td
+# Assure at least one digit is available.
+  s/^\(_*\)$/0\1/
+# Increment the last digit.
+  s/8\(_*\)$/9\1/
+  s/7\(_*\)$/8\1/
+  s/6\(_*\)$/7\1/
+  s/5\(_*\)$/6\1/
+  s/4\(_*\)$/5\1/
+  s/3\(_*\)$/4\1/
+  s/2\(_*\)$/3\1/
+  s/1\(_*\)$/2\1/
+  s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+  s/_/0/g
+  x
+  G
+  s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
+}
+#
+# The .msg file contains, other than the .po file, only the translations
+# but each given a unique ID.  Starting from 1 and incrementing by 1 for
+# each message we assign them to the messages.
+# It is important that the .po file used to generate the cat-id-tbl.c file
+# (with po-to-tbl) is the same as the one used here.  (At least the order
+# of declarations must not be changed.)
+#
+/^msgstr/ {
+  s/msgstr[ 	]*"\(.*\)"/# \1/
+# Clear substitution flag.
+  tb
+# Append the next line.
+  :b
+  N
+# Look whether second part is continuation line.
+  s/\(.*\n\)"\(.*\)"/\1\2/
+# Yes, then branch.
+  ta
+  P
+  D
+# Note that D includes a jump to the start!!
+# We found a continuation line.  But before printing insert '\'.
+  :a
+  s/\(.*\)\(\n.*\)/\1\\\2/
+  P
+# We cannot use D here.
+  s/.*\n\(.*\)/\1/
+  tb
+}
+d
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
new file mode 100644
index 0000000..f4ebf6d
--- /dev/null
+++ b/intl/loadinfo.h
@@ -0,0 +1,76 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef PARAMS
+# if __STDC__
+#  define PARAMS(args) args
+# else
+#  define PARAMS(args) ()
+# endif
+#endif
+
+/* Encoding of locale name parts.  */
+#define CEN_REVISION		1
+#define CEN_SPONSOR		2
+#define CEN_SPECIAL		4
+#define XPG_NORM_CODESET	8
+#define XPG_CODESET		16
+#define TERRITORY		32
+#define CEN_AUDIENCE		64
+#define XPG_MODIFIER		128
+
+#define CEN_SPECIFIC	(CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
+#define XPG_SPECIFIC	(XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
+
+
+struct loaded_l10nfile
+{
+  const char *filename;
+  int decided;
+
+  const void *data;
+
+  struct loaded_l10nfile *next;
+  struct loaded_l10nfile *successor[1];
+};
+
+
+extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset,
+						  size_t name_len));
+
+extern struct loaded_l10nfile *
+_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
+			    const char *dirlist, size_t dirlist_len, int mask,
+			    const char *language, const char *territory,
+			    const char *codeset,
+			    const char *normalized_codeset,
+			    const char *modifier, const char *special,
+			    const char *sponsor, const char *revision,
+			    const char *filename, int do_allocate));
+
+
+extern const char *_nl_expand_alias PARAMS ((const char *name));
+
+extern int _nl_explode_name PARAMS ((char *name, const char **language,
+				     const char **modifier,
+				     const char **territory,
+				     const char **codeset,
+				     const char **normalized_codeset,
+				     const char **special,
+				     const char **sponsor,
+				     const char **revision));
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
new file mode 100644
index 0000000..515892d
--- /dev/null
+++ b/intl/loadmsgcat.c
@@ -0,0 +1,222 @@
+/* Load needed message catalogs.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
+# include <sys/mman.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ISO C functions.  This is required by the standard
+   because some ISO C functions will require linking with this object
+   file and the name space must not be polluted.  */
+# define open   __open
+# define close  __close
+# define read   __read
+# define mmap   __mmap
+# define munmap __munmap
+#endif
+
+/* We need a sign, whether a new catalog was loaded, which can be associated
+   with all translations.  This is important if the translations are
+   cached by one of GCC's features.  */
+int _nl_msg_cat_cntr = 0;
+
+
+/* Load the message catalogs specified by FILENAME.  If it is no valid
+   message catalog do nothing.  */
+void
+internal_function
+_nl_load_domain (domain_file)
+     struct loaded_l10nfile *domain_file;
+{
+  int fd;
+  size_t size;
+  struct stat st;
+  struct mo_file_header *data = (struct mo_file_header *) -1;
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || defined _LIBC
+  int use_mmap = 0;
+#endif
+  struct loaded_domain *domain;
+
+  domain_file->decided = 1;
+  domain_file->data = NULL;
+
+  /* If the record does not represent a valid locale the FILENAME
+     might be NULL.  This can happen when according to the given
+     specification the locale file name is different for XPG and CEN
+     syntax.  */
+  if (domain_file->filename == NULL)
+    return;
+
+  /* Try to open the addressed file.  */
+  fd = open (domain_file->filename, O_RDONLY);
+  if (fd == -1)
+    return;
+
+  /* We must know about the size of the file.  */
+  if (fstat (fd, &st) != 0
+      || (size = (size_t) st.st_size) != st.st_size
+      || size < sizeof (struct mo_file_header))
+    {
+      /* Something went wrong.  */
+      close (fd);
+      return;
+    }
+
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || defined _LIBC
+  /* Now we are ready to load the file.  If mmap() is available we try
+     this first.  If not available or it failed we try to load it.  */
+  data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
+					 MAP_PRIVATE, fd, 0);
+
+  if (data != (struct mo_file_header *) -1)
+    {
+      /* mmap() call was successful.  */
+      close (fd);
+      use_mmap = 1;
+    }
+#endif
+
+  /* If the data is not yet available (i.e. mmap'ed) we try to load
+     it manually.  */
+  if (data == (struct mo_file_header *) -1)
+    {
+      size_t to_read;
+      char *read_ptr;
+
+      data = (struct mo_file_header *) malloc (size);
+      if (data == NULL)
+	return;
+
+      to_read = size;
+      read_ptr = (char *) data;
+      do
+	{
+	  long int nb = (long int) read (fd, read_ptr, to_read);
+	  if (nb == -1)
+	    {
+	      close (fd);
+	      return;
+	    }
+
+	  read_ptr += nb;
+	  to_read -= nb;
+	}
+      while (to_read > 0);
+
+      close (fd);
+    }
+
+  /* Using the magic number we can test whether it really is a message
+     catalog file.  */
+  if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
+    {
+      /* The magic number is wrong: not a message catalog file.  */
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || defined _LIBC
+      if (use_mmap)
+	munmap ((caddr_t) data, size);
+      else
+#endif
+	free (data);
+      return;
+    }
+
+  domain_file->data
+    = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
+  if (domain_file->data == NULL)
+    return;
+
+  domain = (struct loaded_domain *) domain_file->data;
+  domain->data = (char *) data;
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || defined _LIBC
+  domain->use_mmap = use_mmap;
+#endif
+  domain->mmap_size = size;
+  domain->must_swap = data->magic != _MAGIC;
+
+  /* Fill in the information about the available tables.  */
+  switch (W (domain->must_swap, data->revision))
+    {
+    case 0:
+      domain->nstrings = W (domain->must_swap, data->nstrings);
+      domain->orig_tab = (struct string_desc *)
+	((char *) data + W (domain->must_swap, data->orig_tab_offset));
+      domain->trans_tab = (struct string_desc *)
+	((char *) data + W (domain->must_swap, data->trans_tab_offset));
+      domain->hash_size = W (domain->must_swap, data->hash_tab_size);
+      domain->hash_tab = (nls_uint32 *)
+	((char *) data + W (domain->must_swap, data->hash_tab_offset));
+      break;
+    default:
+      /* This is an illegal revision.  */
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+    || defined _LIBC
+      if (use_mmap)
+	munmap ((caddr_t) data, size);
+      else
+#endif
+	free (data);
+      free (domain);
+      domain_file->data = NULL;
+      return;
+    }
+
+  /* Show that one domain is changed.  This might make some cached
+     translations invalid.  */
+  ++_nl_msg_cat_cntr;
+}
+
+
+#ifdef _LIBC
+void
+internal_function
+_nl_unload_domain (domain)
+     struct loaded_domain *domain;
+{
+  if (domain->use_mmap)
+    munmap ((caddr_t) domain->data, domain->mmap_size);
+  else
+    free ((void *) domain->data);
+
+  free (domain);
+}
+#endif
diff --git a/intl/localealias.c b/intl/localealias.c
new file mode 100644
index 0000000..bca555a
--- /dev/null
+++ b/intl/localealias.c
@@ -0,0 +1,424 @@
+/* Handle aliases for locale names.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+# define HAVE_ALLOCA 1
+#else
+# if defined HAVE_ALLOCA_H || defined _LIBC
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+#  include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+#  define _GNU_SOURCE	1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+#  define strchr index
+# endif
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions.  This is required by the standard
+   because some ANSI C functions will require linking with this object
+   file and the name space must not be polluted.  */
+# define strcasecmp __strcasecmp
+
+# define mempcpy __mempcpy
+# define HAVE_MEMPCPY	1
+
+/* We need locking here since we can be called from different places.  */
+# include <bits/libc-lock.h>
+
+__libc_lock_define_initialized (static, lock);
+#endif
+
+
+/* For those loosing systems which don't have `alloca' we have to add
+   some additional code emulating it.  */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done.  */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+  void *address;
+  struct block_list *next;
+};
+# define ADD_BLOCK(list, addr)						      \
+  do {									      \
+    struct block_list *newp = (struct block_list *) malloc (sizeof (*newp));  \
+    /* If we cannot get a free block we cannot add the new element to	      \
+       the list.  */							      \
+    if (newp != NULL) {							      \
+      newp->address = (addr);						      \
+      newp->next = (list);						      \
+      (list) = newp;							      \
+    }									      \
+  } while (0)
+# define FREE_BLOCKS(list)						      \
+  do {									      \
+    while (list != NULL) {						      \
+      struct block_list *old = list;					      \
+      list = list->next;						      \
+      free (old);							      \
+    }									      \
+  } while (0)
+# undef alloca
+# define alloca(size) (malloc (size))
+#endif	/* have alloca */
+
+
+struct alias_map
+{
+  const char *alias;
+  const char *value;
+};
+
+
+static char *string_space = NULL;
+static size_t string_space_act = 0;
+static size_t string_space_max = 0;
+static struct alias_map *map;
+static size_t nmap = 0;
+static size_t maxmap = 0;
+
+
+/* Prototypes for local functions.  */
+static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
+     internal_function;
+static void extend_alias_table PARAMS ((void));
+static int alias_compare PARAMS ((const struct alias_map *map1,
+				  const struct alias_map *map2));
+
+
+const char *
+_nl_expand_alias (name)
+    const char *name;
+{
+  static const char *locale_alias_path = LOCALE_ALIAS_PATH;
+  struct alias_map *retval;
+  const char *result = NULL;
+  size_t added;
+
+#ifdef _LIBC
+  __libc_lock_lock (lock);
+#endif
+
+  do
+    {
+      struct alias_map item;
+
+      item.alias = name;
+
+      if (nmap > 0)
+	retval = (struct alias_map *) bsearch (&item, map, nmap,
+					       sizeof (struct alias_map),
+					       (int (*) PARAMS ((const void *,
+								 const void *))
+						) alias_compare);
+      else
+	retval = NULL;
+
+      /* We really found an alias.  Return the value.  */
+      if (retval != NULL)
+	{
+	  result = retval->value;
+	  break;
+	}
+
+      /* Perhaps we can find another alias file.  */
+      added = 0;
+      while (added == 0 && locale_alias_path[0] != '\0')
+	{
+	  const char *start;
+
+	  while (locale_alias_path[0] == ':')
+	    ++locale_alias_path;
+	  start = locale_alias_path;
+
+	  while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
+	    ++locale_alias_path;
+
+	  if (start < locale_alias_path)
+	    added = read_alias_file (start, locale_alias_path - start);
+	}
+    }
+  while (added != 0);
+
+#ifdef _LIBC
+  __libc_lock_unlock (lock);
+#endif
+
+  return result;
+}
+
+
+static size_t
+internal_function
+read_alias_file (fname, fname_len)
+     const char *fname;
+     int fname_len;
+{
+#ifndef HAVE_ALLOCA
+  struct block_list *block_list = NULL;
+#endif
+  FILE *fp;
+  char *full_fname;
+  size_t added;
+  static const char aliasfile[] = "/locale.alias";
+
+  full_fname = (char *) alloca (fname_len + sizeof aliasfile);
+  ADD_BLOCK (block_list, full_fname);
+#ifdef HAVE_MEMPCPY
+  mempcpy (mempcpy (full_fname, fname, fname_len),
+	   aliasfile, sizeof aliasfile);
+#else
+  memcpy (full_fname, fname, fname_len);
+  memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
+#endif
+
+  fp = fopen (full_fname, "r");
+  if (fp == NULL)
+    {
+      FREE_BLOCKS (block_list);
+      return 0;
+    }
+
+  added = 0;
+  while (!feof (fp))
+    {
+      /* It is a reasonable approach to use a fix buffer here because
+	 a) we are only interested in the first two fields
+	 b) these fields must be usable as file names and so must not
+	    be that long
+       */
+      unsigned char buf[BUFSIZ];
+      unsigned char *alias;
+      unsigned char *value;
+      unsigned char *cp;
+
+      if (fgets (buf, sizeof buf, fp) == NULL)
+	/* EOF reached.  */
+	break;
+
+      /* Possibly not the whole line fits into the buffer.  Ignore
+	 the rest of the line.  */
+      if (strchr (buf, '\n') == NULL)
+	{
+	  char altbuf[BUFSIZ];
+	  do
+	    if (fgets (altbuf, sizeof altbuf, fp) == NULL)
+	      /* Make sure the inner loop will be left.  The outer loop
+		 will exit at the `feof' test.  */
+	      break;
+	  while (strchr (altbuf, '\n') == NULL);
+	}
+
+      cp = buf;
+      /* Ignore leading white space.  */
+      while (isspace (cp[0]))
+	++cp;
+
+      /* A leading '#' signals a comment line.  */
+      if (cp[0] != '\0' && cp[0] != '#')
+	{
+	  alias = cp++;
+	  while (cp[0] != '\0' && !isspace (cp[0]))
+	    ++cp;
+	  /* Terminate alias name.  */
+	  if (cp[0] != '\0')
+	    *cp++ = '\0';
+
+	  /* Now look for the beginning of the value.  */
+	  while (isspace (cp[0]))
+	    ++cp;
+
+	  if (cp[0] != '\0')
+	    {
+	      size_t alias_len;
+	      size_t value_len;
+
+	      value = cp++;
+	      while (cp[0] != '\0' && !isspace (cp[0]))
+		++cp;
+	      /* Terminate value.  */
+	      if (cp[0] == '\n')
+		{
+		  /* This has to be done to make the following test
+		     for the end of line possible.  We are looking for
+		     the terminating '\n' which do not overwrite here.  */
+		  *cp++ = '\0';
+		  *cp = '\n';
+		}
+	      else if (cp[0] != '\0')
+		*cp++ = '\0';
+
+	      if (nmap >= maxmap)
+		extend_alias_table ();
+
+	      alias_len = strlen (alias) + 1;
+	      value_len = strlen (value) + 1;
+
+	      if (string_space_act + alias_len + value_len > string_space_max)
+		{
+		  /* Increase size of memory pool.  */
+		  size_t new_size = (string_space_max
+				     + (alias_len + value_len > 1024
+					? alias_len + value_len : 1024));
+		  char *new_pool = (char *) realloc (string_space, new_size);
+		  if (new_pool == NULL)
+		    {
+		      FREE_BLOCKS (block_list);
+		      return added;
+		    }
+		  string_space = new_pool;
+		  string_space_max = new_size;
+		}
+
+	      map[nmap].alias = memcpy (&string_space[string_space_act],
+					alias, alias_len);
+	      string_space_act += alias_len;
+
+	      map[nmap].value = memcpy (&string_space[string_space_act],
+					value, value_len);
+	      string_space_act += value_len;
+
+	      ++nmap;
+	      ++added;
+	    }
+	}
+    }
+
+  /* Should we test for ferror()?  I think we have to silently ignore
+     errors.  --drepper  */
+  fclose (fp);
+
+  if (added > 0)
+    qsort (map, nmap, sizeof (struct alias_map),
+	   (int (*) PARAMS ((const void *, const void *))) alias_compare);
+
+  FREE_BLOCKS (block_list);
+  return added;
+}
+
+
+static void
+extend_alias_table ()
+{
+  size_t new_size;
+  struct alias_map *new_map;
+
+  new_size = maxmap == 0 ? 100 : 2 * maxmap;
+  new_map = (struct alias_map *) realloc (map, (new_size
+						* sizeof (struct alias_map)));
+  if (new_map == NULL)
+    /* Simply don't extend: we don't have any more core.  */
+    return;
+
+  map = new_map;
+  maxmap = new_size;
+}
+
+
+#ifdef _LIBC
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  if (string_space != NULL)
+    free (string_space);
+  if (map != NULL)
+    free (map);
+}
+text_set_element (__libc_subfreeres, free_mem);
+#endif
+
+
+static int
+alias_compare (map1, map2)
+     const struct alias_map *map1;
+     const struct alias_map *map2;
+{
+#if defined _LIBC || defined HAVE_STRCASECMP
+  return strcasecmp (map1->alias, map2->alias);
+#else
+  const unsigned char *p1 = (const unsigned char *) map1->alias;
+  const unsigned char *p2 = (const unsigned char *) map2->alias;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      /* I know this seems to be odd but the tolower() function in
+	 some systems libc cannot handle nonalpha characters.  */
+      c1 = isupper (*p1) ? tolower (*p1) : *p1;
+      c2 = isupper (*p2) ? tolower (*p2) : *p2;
+      if (c1 == '\0')
+	break;
+      ++p1;
+      ++p2;
+    }
+  while (c1 == c2);
+
+  return c1 - c2;
+#endif
+}
diff --git a/intl/po2tbl.sed.in b/intl/po2tbl.sed.in
new file mode 100644
index 0000000..b3bcca4
--- /dev/null
+++ b/intl/po2tbl.sed.in
@@ -0,0 +1,102 @@
+# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+1 {
+  i\
+/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot.  */\
+\
+#if HAVE_CONFIG_H\
+# include <config.h>\
+#endif\
+\
+#include "libgettext.h"\
+\
+const struct _msg_ent _msg_tbl[] = {
+  h
+  s/.*/0/
+  x
+}
+#
+# Write msgid entries in C array form.
+#
+/^msgid/ {
+  s/msgid[ 	]*\(".*"\)/  {\1/
+  tb
+# Append the next line
+  :b
+  N
+# Look whether second part is continuation line.
+  s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
+# Yes, then branch.
+  ta
+# Because we assume that the input file correctly formed the line
+# just read cannot be again be a msgid line.  So it's safe to ignore
+# it.
+  s/\(.*\)\n.*/\1/
+  bc
+# We found a continuation line.  But before printing insert '\'.
+  :a
+  s/\(.*\)\(\n.*\)/\1\\\2/
+  P
+# We cannot use D here.
+  s/.*\n\(.*\)/\1/
+# Some buggy seds do not clear the `successful substitution since last ``t'''
+# flag on `N', so we do a `t' here to clear it.
+  tb
+# Not reached
+  :c
+  x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+  td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+  :d
+  s/9\(_*\)$/_\1/
+  td
+# Assure at least one digit is available.
+  s/^\(_*\)$/0\1/
+# Increment the last digit.
+  s/8\(_*\)$/9\1/
+  s/7\(_*\)$/8\1/
+  s/6\(_*\)$/7\1/
+  s/5\(_*\)$/6\1/
+  s/4\(_*\)$/5\1/
+  s/3\(_*\)$/4\1/
+  s/2\(_*\)$/3\1/
+  s/1\(_*\)$/2\1/
+  s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+  s/_/0/g
+  x
+  G
+  s/\(.*\)\n\([0-9]*\)/\1, \2},/
+  s/\(.*\)"$/\1/
+  p
+}
+#
+# Last line.
+#
+$ {
+  i\
+};\
+
+  g
+  s/0*\(.*\)/int _msg_tbl_length = \1;/p
+}
+d
diff --git a/intl/textdomain.c b/intl/textdomain.c
new file mode 100644
index 0000000..8855746
--- /dev/null
+++ b/intl/textdomain.c
@@ -0,0 +1,108 @@
+/* Implementation of the textdomain(3) function.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Name of the default text domain.  */
+extern const char _nl_default_default_domain[];
+
+/* Default text domain in which entries for gettext(3) are to be found.  */
+extern const char *_nl_current_default_domain;
+
+
+/* Names for the libintl functions are a problem.  They must not clash
+   with existing names and they should follow ANSI C.  But this source
+   code is also used in GNU C Library where the names have a __
+   prefix.  So we have to make a difference here.  */
+#ifdef _LIBC
+# define TEXTDOMAIN __textdomain
+# ifndef strdup
+#  define strdup(str) __strdup (str)
+# endif
+#else
+# define TEXTDOMAIN textdomain__
+#endif
+
+/* Set the current default message catalog to DOMAINNAME.
+   If DOMAINNAME is null, return the current default.
+   If DOMAINNAME is "", reset to the default of "messages".  */
+char *
+TEXTDOMAIN (domainname)
+     const char *domainname;
+{
+  char *old;
+
+  /* A NULL pointer requests the current setting.  */
+  if (domainname == NULL)
+    return (char *) _nl_current_default_domain;
+
+  old = (char *) _nl_current_default_domain;
+
+  /* If domain name is the null string set to default domain "messages".  */
+  if (domainname[0] == '\0'
+      || strcmp (domainname, _nl_default_default_domain) == 0)
+    _nl_current_default_domain = _nl_default_default_domain;
+  else
+    {
+      /* If the following malloc fails `_nl_current_default_domain'
+	 will be NULL.  This value will be returned and so signals we
+	 are out of core.  */
+#if defined _LIBC || defined HAVE_STRDUP
+      _nl_current_default_domain = strdup (domainname);
+#else
+      size_t len = strlen (domainname) + 1;
+      char *cp = (char *) malloc (len);
+      if (cp != NULL)
+	memcpy (cp, domainname, len);
+      _nl_current_default_domain = cp;
+#endif
+    }
+
+  if (old != _nl_default_default_domain)
+    free (old);
+
+  return (char *) _nl_current_default_domain;
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library.  */
+weak_alias (__textdomain, textdomain);
+#endif
diff --git a/intl/xopen-msg.sed b/intl/xopen-msg.sed
new file mode 100644
index 0000000..e7a4c99
--- /dev/null
+++ b/intl/xopen-msg.sed
@@ -0,0 +1,104 @@
+# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
+# Copyright 1995, 2002 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#
+# The first directive in the .msg should be the definition of the
+# message set number.  We use always set number 1.
+#
+1 {
+  i\
+$set 1 # Automatically created by po2msg.sed
+  h
+  s/.*/0/
+  x
+}
+#
+# We copy all comments into the .msg file.  Perhaps they can help.
+#
+/^#/ s/^#[ 	]*/$ /p
+#
+# We copy the original message as a comment into the .msg file.
+#
+/^msgid/ {
+# Does not work now
+#  /"$/! {
+#    s/\\$//
+#    s/$/ ... (more lines following)"/
+#  }
+  s/^msgid[ 	]*"\(.*\)"$/$ Original Message: \1/
+  p
+}
+#
+# The .msg file contains, other than the .po file, only the translations
+# but each given a unique ID.  Starting from 1 and incrementing by 1 for
+# each message we assign them to the messages.
+# It is important that the .po file used to generate the cat-id-tbl.c file
+# (with po-to-tbl) is the same as the one used here.  (At least the order
+# of declarations must not be changed.)
+#
+/^msgstr/ {
+  s/msgstr[ 	]*"\(.*\)"/\1/
+  x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+  td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+  :d
+  s/9\(_*\)$/_\1/
+  td
+# Assure at least one digit is available.
+  s/^\(_*\)$/0\1/
+# Increment the last digit.
+  s/8\(_*\)$/9\1/
+  s/7\(_*\)$/8\1/
+  s/6\(_*\)$/7\1/
+  s/5\(_*\)$/6\1/
+  s/4\(_*\)$/5\1/
+  s/3\(_*\)$/4\1/
+  s/2\(_*\)$/3\1/
+  s/1\(_*\)$/2\1/
+  s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+  s/_/0/g
+  x
+# Bring the line in the format `<number> <message>'
+  G
+  s/^[^\n]*$/& /
+  s/\(.*\)\n\([0-9]*\)/\2 \1/
+# Clear flag from last substitution.
+  tb
+# Append the next line.
+  :b
+  N
+# Look whether second part is a continuation line.
+  s/\(.*\n\)"\(.*\)"/\1\2/
+# Yes, then branch.
+  ta
+  P
+  D
+# Note that `D' includes a jump to the start!!
+# We found a continuation line.  But before printing insert '\'.
+  :a
+  s/\(.*\)\(\n.*\)/\1\\\2/
+  P
+# We cannot use the sed command `D' here
+  s/.*\n\(.*\)/\1/
+  tb
+}
+d
diff --git a/ltcf-c.sh b/ltcf-c.sh
index 2b02417..e73ff16 100644
--- a/ltcf-c.sh
+++ b/ltcf-c.sh
@@ -223,10 +223,6 @@
     hardcode_shlibpath_var=no
     ;;
 
-  tpf*)
-    ld_shlibs=yes
-    ;;
-
   *)
     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
diff --git a/ltcf-cxx.sh b/ltcf-cxx.sh
index 620b318..465650f 100644
--- a/ltcf-cxx.sh
+++ b/ltcf-cxx.sh
@@ -652,9 +652,6 @@
         ;;
     esac
     ;;
-  tpf*)
-    ld_shlibs=yes
-    ;;
   unixware*)
     # FIXME: insert proper C++ library support
     ld_shlibs=no
diff --git a/ltconfig b/ltconfig
index 2fec9af..7972327 100755
--- a/ltconfig
+++ b/ltconfig
@@ -1371,18 +1371,6 @@
   esac
   ;;
 
-tpf*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $major $libname.so'
-  soname_spec='${libname}${release}.so$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
 uts4*)
   version_type=linux
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
diff --git a/mmalloc/COPYING.LIB b/mmalloc/COPYING.LIB
new file mode 100644
index 0000000..eb685a5
--- /dev/null
+++ b/mmalloc/COPYING.LIB
@@ -0,0 +1,481 @@
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+                    675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+     Appendix: How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/mmalloc/ChangeLog b/mmalloc/ChangeLog
new file mode 100644
index 0000000..a1e3ad0
--- /dev/null
+++ b/mmalloc/ChangeLog
@@ -0,0 +1,491 @@
+2003-08-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* Makefile.in (install-info): Create dest dir. Support DESTDIR.
+	(install): Likewise.
+
+2002-11-28  Elena Zannoni  <ezannoni@redhat.com>
+
+	* Makefile.in (install): Move install-info to here...
+	(all): ...from here.
+
+2002-11-26  Elena Zannoni  <ezannoni@redhat.com>
+
+	* Makefile.in (INFO_DEPS): Define.
+	(all): Add install-info to the rule.
+	(info): Unse INFO_DEPS.
+	(install-info): Rewrite.
+	(uninstall-info): New.
+	(uninstall): New.
+
+2002-04-07  Andrew Cagney  <ac131313@redhat.com>
+
+	From 2002-03-05 Scott Pakin <pakin@uiuc.edu>
+	* mmap-sup.c (MAP_PRIVATE_OR_SHARED): Define.
+	(__mmalloc_mmap_morecore): Use.
+	(__mmalloc_remap_core): Use.
+	
+2000-05-17  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* Makefile.in (install-info): Make sure $(infodir) exists.  Run
+	install-info program on the installed Info files.
+
+2000-03-20  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* Makefile.in (install): Append "n", not ".n" to libmmalloc.a,
+	since the latter loses on DOS 8+3 filesystems.
+
+Mon Feb 28 10:33:51 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS: New file.
+
+2000-02-18  Frank Ch. Eigler  <fche@redhat.com>
+
+	From Jason "crash" Molenda <jsm@cygnus.com>:
+	* configure.in: Check for getpagesize declaration.
+	* mvmalloc.c, mmap-sup.c: Conditionally declare getpagesize.
+	* configure: Regenerated.
+
+Fri Feb 18 11:42:21 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in: Check for <unistd.h>.
+	* configure: Regenerate.
+
+	From 2000-02-17 RodneyBrown@pmsc.com:
+	* mm.c, attach.c, mmap-sup.c, sbrk-sup.c: Include <unistd.h> for
+ 	sbrk and lseek declarations.  Update copyright.
+
+2000-02-04  Kevin Buettner  (kevinb@cygnus.com)
+
+	* acinclude.m4, aclocal.m4: New files.
+	* configure.in (sbrk): Use BFD_NEED_DECLARATION to test for
+	presence of a suitable declaration in the system headers.
+	* configure: Regenerated.
+	* sbrk-sup.c (sbrk): Ifdef'd with NEED_DECLARATION_SBRK.
+
+1999-01-04  Jason Molenda  (jsm@bugshack.cygnus.com)
+
+	* configure.in: Requires autoconf 2.12.1 or higher.
+	* configure: Regenerated.
+
+1998-07-24  Jim Blandy  <jimb@zwingli.cygnus.com>
+
+	* mcalloc.c: #include <sys/types.h> before <string.h>.  HP/UX 11.0
+	needs this.
+
+Thu Apr 23 12:19:22 1998  Philippe De Muyter  <phdm@macqel.be>
+
+        * mmalloc.h: Include sys/types.h and stdio.h #ifndef HAVE_STDDEF_H.
+        * mmprivate.h: Do not handle HAVE_STDDEF_H here, since we include
+        mmalloc.h.
+
+Tue Mar 24 17:07:02 1998  Stu Grossman  <grossman@bhuna.cygnus.co.uk>
+
+	* Makefile.in:  Get SHELL from configure.
+	* configure:  Regenerate with autoconf 2.12.1 to fix shell issues for
+	NT native builds.
+
+Mon Feb  7 13:06:45 1997  Philippe De Muyter  <phdm@macqel.be>
+
+        * mmalloc/detach.c: Do not include fcntl.h.
+
+Thu Aug 28 13:15:07 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mrealloc.c (realloc): Store result in local variable before
+ 	returning it.  Makes debugging much easier at negligible cost.
+
+Tue Feb  4 16:30:59 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* mvalloc.c (cache_pagesize): Rename from pagesize, so that if we
+	are building mm.o, it does not conflict with the variable of the
+	same name in mmap-sup.c.
+
+Sat Dec 28 12:48:32 1996  Fred Fish  <fnf@cygnus.com>
+
+	* Makefile.in (mm.o): New target that combines all the functions
+	into a single object module.  This avoids client programs picking
+ 	up part of the allocation routines from mmalloc and part from libc,
+ 	which can lead to undefined behavior.
+	(CFILES): Add mm.c
+	(TARGETOBJS): Define to be either the individual objects or the
+	single combined object.
+	(TARGETLIB): Create the archive using TARGETOBJS.
+	* mm.c: New file that simply #includes the other source C files.
+	
+Thu Oct  3 15:45:23 1996  Jason Molenda  (crash@godzilla.cygnus.co.jp)
+
+	* Makefile.in (maintainer-clean): Depend on distclean, remove
+	duplication.
+
+Tue Sep 10 17:52:06 1996  Fred Fish  <fnf@cygnus.com>
+
+	* mmcheck.c (checkhdr): Add prototype.
+	(mfree_check): Ditto.
+	(mmalloc_check): Ditto.
+	(mrealloc_check): Ditto.
+	* mmtrace.c (tr_break): Ditto.
+	(tr_freehook): Ditto.
+	(tr_mallochook): Ditto.
+	(tr_reallochook): Ditto.
+	* sbrk-sup.c (sbrk_morecore): Ditto.
+
+Wed Sep  4 18:02:45 1996  Stu Grossman  (grossman@critters.cygnus.com)
+
+	* configure configure.in:  Don't default CC to cc.  It causes problems
+	when starting a compile in the mmalloc directory.
+
+Wed Jul 24 00:53:34 1996  Fred Fish  <fnf@cygnus.com>
+
+	* mmalloc.h (mmalloc_findbase): Add prototype.
+
+Fri Jul 12 18:35:34 1996  Fred Fish  <fnf@cygnus.com>
+
+	* mmap-sup.c (mmalloc_findbase): Change to not require /dev/zero
+	if MMAP_ANONYMOUS is available.
+
+Wed Jul 10 23:53:42 1996  Fred Fish  <fnf@cygnus.com>
+
+	* detach.c (mmalloc_detach): Fix bug in computation of negative
+	brk value.
+	* mmcheck.c (mmcheckf): Renamed from mmcheck and new FORCE argument
+	added.  Replaced hack that always allowed checking routines to be
+ 	installed and enforce restriction that they have to be installed
+	prior to allocating any memory on the used heap or the FORCE argument
+	has to be non-NULL.
+	(mmcheck): New function that calls mmcheckf with FORCE set to zero,
+	for backwards compatibility.
+	* mmalloc.c (malloc): Store result in local variable before
+	returning it.  Makes debugging much easier at negligible cost.
+	* mmalloc.h (mmcheckf): Declare.
+	* attach.c (reuse): Call mmcheckf rather than mmcheck.
+	* mmap-sup.c (__mmalloc_mmap_morecore): Improve to allow mmap
+	to select a base mapping address if none is otherwise given.
+	(mmalloc_findbase): New function that user can call to find
+	an available mapping address of a given size.
+	
+Tue Jun 25 22:54:06 1996  Jason Molenda  (crash@godzilla.cygnus.co.jp)
+
+	* Makefile.in (bindir, libdir, datadir, mandir, infodir, includedir):
+	Use autoconf-set values.
+	(docdir): Removed.
+	* configure.in (AC_PREREQ): autoconf 2.5 or higher.
+	* configure: Rebuilt.
+
+Tue May 28 13:51:22 1996  Fred Fish  <fnf@cygnus.com>
+
+	From: Thomas A Peterson <tap@src.honeywell.com>
+	* Makefile.in (install-info): Apply patch to install
+	mmalloc.info from srcdir if not found in build dir.
+
+Sun Apr  7 20:55:30 1996  Fred Fish  <fnf@rtl.cygnus.com>
+
+	From: Miles Bader  <miles@gnu.ai.mit.edu>
+	* configure.in: Use AC_CHECK_TOOL to find AR & RANLIB.
+	* configure: Regenerate with autoconf.
+	* Makefile.in: Use AR set by configure substitution.
+	
+Fri Mar 29 09:57:36 1996  Fred Fish  <fnf@cygnus.com>
+
+	* mmalloc.h (mmtrace): Add prototype.
+
+Sat Feb  3 12:41:00 1996  Fred Fish  <fnf@cygnus.com>
+
+	From H.J. Lu (hjl@gnu.ai.mit.edu):
+	* mvalloc.c (valloc): new.
+	* mmemalign.c: Allocate (SIZE + ALIGNMENT - 1) and then trim
+	if possible.
+	(memalign): don't put the node on the _aligned_blocks list more
+ 	than once.
+
+Mon Nov 20 12:04:32 1995  Fred Fish  <fnf@cygnus.com>
+
+	* Makefile.in (OFILES): Make objects depend upon Makefile,
+	since Makefile sets DEFS which can definitely affect how
+	objects are to be compiled.
+
+Mon Nov  6 14:12:13 1995  Jason Molenda  (crash@phydeaux.cygnus.com)
+
+	* configure.in (AC_CHECK_HEADERS): add limits.h.
+	(AC_HEADER_STDC): remove.
+
+	* mmalloc.h: document necessity of defining size_t before
+	including mmalloc.h.
+
+	* mmprivate.h: add check for limits.h, remove definition of
+	NULL and size_t.
+
+Sun Nov  5 00:27:36 1995  Jason Molenda  (crash@phydeaux.cygnus.com)
+
+	* configure.in: AC_CHECK_HEADERS, not AC_CHECK_HEADER.
+
+Sun Nov  5 00:14:13 1995  Jason Molenda  (crash@phydeaux.cygnus.com)
+
+	* configure.in: add check for stddef.h
+	* mmalloc.h: include stddef.h if HAVE_STDDEF_H is defined.
+
+Sat Nov  4 19:10:13 1995  Jason Molenda  (crash@phydeaux.cygnus.com)
+
+	* configure.in: add AC_HEADER_STDC check.
+
+	* mmalloc.h: check if STDC_HEADERS instead of __STDC__.
+
+	* mmprivate.h: check if STDC_HEADERS instead of __STDC__.
+
+Tue Oct 24 13:17:44 1995  Stan Shebs  <shebs@andros.cygnus.com>
+
+	* mmprivate.h: Remove declarations (PTR, etc) that are already
+	provided by ansidecl.h, include mmalloc.h earlier in file.
+
+Tue Oct 10 11:04:47 1995  Fred Fish  <fnf@cygnus.com>
+
+	* Makefile.in (BISON):  Remove macro.
+
+Wed Sep 20 12:51:13 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+	* Makefile.in (maintainer-clean): New target, synonym for
+	realclean.  Add GNU standard maintainer-clean echos.
+
+Thu Aug  3 10:45:37 1995  Fred Fish  <fnf@cygnus.com>
+
+	* Update all FSF addresses except those in COPYING* files
+	and shar archive of original FSF files.
+
+Mon Jun 12 12:11:57 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
+
+	* Makefile.in (distclean, realclean): Remove config.cache and
+	  config.log.
+
+Wed May 17 17:47:44 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
+
+	* Makefile.in (Makefile): Added config.status to dependency list.
+	  (config.status): New target.
+
+Fri May  5 15:17:53 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
+
+	* mmap-sup.c: Removed munmap prototype.  Some systems have a
+	  slightly different prototype.
+
+Wed May  3 17:18:13 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
+
+	* Makefile.in, configure.in: Converted to use autoconf.
+	* configure: New file, generated with autoconf 2.3.
+	* config/{mh-go32, mh-irix, mh-ncr3000, mh-sunos4, 
+	  mh-sysv4}: Removed.
+
+Thu Nov  3 23:55:21 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+
+	* Makefile.in (install-info): Name destination file correctly,
+	rather than using undefined shell variable.
+
+Fri Oct 28 16:46:58 1994  Stan Shebs  (shebs@andros.cygnus.com)
+
+	* mmprivate.h: New file, was mmalloc.h.
+	(mmalloc.h): Include.
+	* mmalloc.h: Remove all but declarations of mmalloc functions.
+	(ansidecl.h): Include.
+	* attach.c, et al: Include mmprivate.h instead of mmalloc.h.
+
+Wed Aug 24 12:55:33 1994  Ian Lance Taylor  (ian@sanguine.cygnus.com)
+
+	* configure.in: Change i[34]86 to i[345]86.
+
+Mon Aug 22 11:36:40 1994  Stan Shebs  (shebs@andros.cygnus.com)
+
+	* Makefile.in (distclean): Separate from realclean.
+	(realclean): Remove mmalloc.info.
+
+Fri May  6 13:04:25 1994  Steve Chamberlain  (sac@cygnus.com)
+
+        * config/go32.mh: New file
+	* configure.in (host==go32):  Use new fragment.
+
+Tue Feb  8 00:32:28 1994  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+
+	* mmtrace.c (tr_freehook, tr_mallochook, tr_reallochook):
+	Cast addresses put out via fprintf to unsigned long and use %lx.
+
+Tue Nov 16 20:33:17 1993  Jim Kingdon  (kingdon@deneb.cygnus.com)
+
+	* COPYING.LIB: New file (standard version 2 LGPL, as already cited
+	by the source files).
+
+Fri Nov  5 11:47:33 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+	* Makefile.in (info dvi install-info): Actually make the manual.
+
+Mon Nov  1 14:20:25 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+	* mmalloc.texi: Fix typo ("for for" -> "for").
+
+Fri Jul 16 15:27:08 1993  Jim Kingdon  (kingdon@rtl.cygnus.com)
+
+	* test1.c: New file which tests for bug fixed below.
+	* Makefile.in (check): Put in commands to run it (but commented out
+	because it won't work for Canadian cross).
+
+	* mmalloc.c (mmalloc): When extending a free block at the end of the
+	heap, check whether which block is at the end changed.
+
+	* Makefile.in (TAGS): make work when srcdir != objdir.
+
+Thu Jul 15 07:56:47 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+	* attach.c, detach.c: Include <sys/types.h> before <fcntl.h>.
+
+Wed Jun 30 11:00:53 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+	* Makefile.in: Add mostlyclean and realclean targets.
+
+Wed Mar 24 01:58:12 1993  david d `zoo' zuhn  (zoo at poseidon.cygnus.com)
+
+	* Makefile.in: add dvi and installcheck targets
+
+Fri Mar 12 18:35:43 1993  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
+
+	* configure.in: recognize *-*-solaris2* instead of *-*-solaris* (a
+	number of people want to call SunOS 4.1.2 "solaris1.0" and get it right)
+
+Mon Feb 22 18:08:53 1993  John Gilmore  (gnu@cygnus.com)
+
+	* Makefile.in (distclean):  Add.
+
+Tue Feb 16 08:09:15 1993  Fred Fish  (fnf@cygnus.com)
+
+	* Makefile.in, attach.c, detach.c, keys.c, mmap-sup.c, mmtrace.c,
+	sbrk-sup.c:  Use GNU Library General Public License, like other
+	files.
+
+Wed Nov 18 19:18:59 1992  John Gilmore  (gnu@cygnus.com)
+
+	* configure.in:  Regularize list of host configs.
+
+Fri Oct 30 00:59:46 1992  John Gilmore  (gnu@cygnus.com)
+
+	* mmalloc.texi:  Add missing doubled @.  Bugfix by Paul Eggert.
+
+Fri Oct 23 01:50:52 1992  Stu Grossman  (grossman at cygnus.com)
+
+	* configure.in:  Handle solaris same as sysv4.
+
+Thu Oct  1 23:34:20 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
+
+	* configure.in: use cpu-vendor-os triple instead of nested cases
+
+Sun Aug 23 11:09:46 1992  Fred Fish  (fnf@cygnus.com)
+
+	* sbrk-sup.c (__mmalloc_brk_init):  Ensure base of sbrk'd region
+	is aligned.  Bug reported by Andrew Heybey (ath@lcs.mit.edu).
+
+Wed Aug 19 14:49:23 1992  Ian Lance Taylor  (ian@cygnus.com)
+
+	* Makefile.in: always create installation directories.
+
+Mon Jul 20 21:15:44 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mrealloc.c:  Minor code format style changes for consistency.
+
+Fri Jul  3 20:25:30 1992  Fred Fish  (fnf@cygnus.com)
+
+	* attach.c, detach.c, mcalloc.c, mmalloc.c, mmtrace.c, mrealloc.c,
+	sbrk-sup.c:  Remove "(void)" casts from function calls where the
+	return value is ignored, in accordance with GNU coding standards.
+
+Tue Jun 30 16:44:41 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mmalloc.h (struct mdesc):  Add FIXME comments to point out the
+	need to save some data on a per-process basis for mapped regions
+	that are shared.
+	* attach.c (reuse):  Update the morecore field for reused mapped
+	regions to be correct for the current process.
+
+Mon Jun 29 10:45:25 1992  Fred Fish  (fnf at cygnus.com)
+
+	* mmtrace.c:  Lint.
+
+Mon Jun 15 12:20:16 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mmalloc.h (struct mdesc):  Change member "errno" to
+	"saved_errno" to avoid possible conflict with ANSI C environments,
+	where it is allowed to be a macro.
+	* config/mh-ncr3000 (INSTALL):  Don't use /usr/ucb/install,
+	it is broken on ncr 3000's.
+	* config/mh-ncr3000 (RANLIB):  Use RANLIB=true.
+
+Fri Jun 12 21:34:21 1992  John Gilmore  (gnu at cygnus.com)
+
+	* mmap-sup.c:  Avoid ANSI C "empty translation unit" idiocy.
+
+Tue Jun  9 17:29:04 1992  Fred Fish  (fnf@cygnus.com)
+
+	* config/{mh-ncr3000, mh-sysv4}:  Add definition for INSTALL using
+	/usr/ucb/install.
+
+Thu Apr 30 22:36:31 1992  Fred Fish  (fnf@cygnus.com)
+
+	* sbrk-sup.c (sbrk_morecore):  Fix sbrk() error return test.
+
+Mon Apr 20 21:03:30 1992  K. Richard Pixley  (rich@cygnus.com)
+
+	* Makefile.in: rework CFLAGS so that they can be passed from the
+	  command line.  remove MINUS_G.  Default CFLAGS to -g.
+
+Thu Apr 16 20:00:21 1992  Fred Fish  (fnf@cygnus.com)
+
+	* TODO:  New file.
+	* attach.c, mcalloc.c, mfree.c, mmalloc.c, mmalloc.h, mmap-sup.c,
+	mmcheck.c, mtrace.c, mrealloc.c, mvalloc.c, sbrk-sup.c:  Lint.
+
+Fri Apr 10 22:59:17 1992  Fred Fish  (fnf@cygnus.com)
+
+	* configure.in:  Recognize new ncr3000 config.
+	* config/mh-ncr3000:  New config file.
+	* Makefile.in (MINUS_G):  Add macro and default to -g.
+
+Wed Apr  8 09:34:53 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mmalloc.c:  Minor fix to comment.
+	* mmalloc.texi:  Update to match actual implementation
+	* mmalloc.h (morecore):  Change prototype's 2nd arg to int.
+
+Tue Apr  7 22:16:09 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mmalloc.h (size_t, CHAR_BIT):  Only redefine if not already
+	defined.
+
+Mon Apr  6 20:49:33 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mmalloc.h:  Remove include of <stdlib.h>.  This also gets rid
+	of the ugly kludge installed on 1-Apr-92.
+
+Mon Apr  6 16:33:37 1992  Stu Grossman  (grossman at cygnus.com)
+
+	* detach.c (mmalloc_detach):  Arg should be PTR, not void *.
+	Fixes complaints from non __STDC__ systems.
+
+Wed Apr  1 11:47:02 1992  Fred Fish  (fnf@cygnus.com)
+
+	* mcalloc.c, mfree.c, mmalloc.c, mrealloc.c:  Minor comment
+	change.
+	* mmalloc.h:  Add ugly kludge to band-aid over problems with
+	bogus vendor <stdlib.h> files.
+
+Sun Mar 29 12:41:31 1992  John Gilmore  (gnu at cygnus.com)
+
+	* attach.c, mmalloc.c, mmcheck.c:  Lint.
+
+Thu Mar 26 17:06:04 1992  Fred Fish  (fnf@cygnus.com)
+
+	* attach.c (reuse):  Explicitly discard return value of mmcheck.
+	* mmcheck.c (mmcheck):  Document requirements for installing
+	corruption checking hooks and set up to enforce restrictions.
+
+Tue Mar 24 23:41:10 1992  K. Richard Pixley  (rich@cygnus.com)
+
+	* config/mh-irix4: new file.
+
+	* Makefile.in: added standard targets, fixed install directories.
+
+Sat Mar 14 17:34:59 1992  Fred Fish  (fnf@cygnus.com)
+
+	* Initial release, incorporated into gdb.
+
+
diff --git a/mmalloc/MAINTAINERS b/mmalloc/MAINTAINERS
new file mode 100644
index 0000000..0904867
--- /dev/null
+++ b/mmalloc/MAINTAINERS
@@ -0,0 +1,5 @@
+The mmalloc directory is maintained by the GDB group's Host
+maintainers.
+
+This code is in a maintain-only phase - only configury patches fixing
+host compile problems are generally accepted.
diff --git a/mmalloc/Makefile.in b/mmalloc/Makefile.in
new file mode 100644
index 0000000..b05aea7
--- /dev/null
+++ b/mmalloc/Makefile.in
@@ -0,0 +1,247 @@
+# Copyright (C) 1992 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+#
+# Makefile for mmalloc directory
+#
+
+# Directory containing source files.  Don't clean up the spacing,
+# this exact string is matched for by the "configure" script.
+
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+prefix =	@prefix@
+exec_prefix =	@exec_prefix@
+
+bindir =	@bindir@
+libdir =	@libdir@
+
+datadir =	@datadir@
+mandir =	@mandir@
+man1dir =	$(mandir)/man1
+man2dir =	$(mandir)/man2
+man3dir =	$(mandir)/man3
+man4dir =	$(mandir)/man4
+man5dir =	$(mandir)/man5
+man6dir =	$(mandir)/man6
+man7dir =	$(mandir)/man7
+man8dir =	$(mandir)/man8
+man9dir =	$(mandir)/man9
+infodir =	@infodir@
+includedir =	@includedir@
+
+SHELL =		@SHELL@
+
+INSTALL =	@INSTALL@
+INSTALL_PROGRAM=@INSTALL_PROGRAM@
+INSTALL_DATA =	@INSTALL_DATA@
+
+AR =		@AR@
+AR_FLAGS =	qv
+CFLAGS =	-g
+MAKEINFO =	makeinfo
+RANLIB =	@RANLIB@
+RM =		rm
+
+# where to find makeinfo
+MAKEINFO=makeinfo
+
+SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
+
+# Files which should be generated via 'info' and installed by 'install-info'
+INFO_DEPS = mmalloc.info
+
+# The TeX formatter
+TEX = tex
+
+TARGETLIB =	libmmalloc.a
+
+CFILES =	mcalloc.c mfree.c mmalloc.c mmcheck.c mmemalign.c mmstats.c \
+		mmtrace.c mrealloc.c mvalloc.c mmap-sup.c attach.c detach.c \
+		keys.c sbrk-sup.c mm.c
+
+HFILES =	mmalloc.h
+
+OFILES =	mcalloc.o mfree.o mmalloc.o mmcheck.o mmemalign.o mmstats.o \
+		mmtrace.o mrealloc.o mvalloc.o mmap-sup.o attach.o detach.o \
+		keys.o sbrk-sup.o
+
+DEFS =		@DEFS@
+
+# The current default is to build a single object module with all the mmalloc
+# functions.  To build a more traditional library, flip this macro definition.
+#TARGETOBJS =	$(OFILES)
+TARGETOBJS =	mm.o
+
+.c.o:
+		$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $<
+
+# Do we want/need any config overrides?
+#	 
+
+STAGESTUFF =	$(TARGETLIB) *.o
+
+all:		$(TARGETLIB)
+
+info: $(INFO_DEPS)
+dvi: mmalloc.dvi
+clean-info:
+installcheck:
+
+mmalloc.info: mmalloc.texi
+	$(MAKEINFO) -I $(srcdir) -o ./mmalloc.info mmalloc.texi
+
+# This file doesn't need texindex currently.
+mmalloc.dvi: mmalloc.texi
+	$(SET_TEXINPUTS) $(TEX) mmalloc.texi
+	rm -f mmalloc.?? mmalloc.??s mmalloc.log mmalloc.aux mmalloc.toc
+
+install-info: info
+	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(infodir)
+	@list='$(INFO_DEPS)'; \
+	for file in $$list; do \
+	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
+	  for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
+	    if test -f $$d/$$ifile; then \
+	      echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
+	      $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
+	    else : ; fi; \
+	  done; \
+	done
+	$(POST_INSTALL)
+	@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
+	  list='$(INFO_DEPS)'; \
+	  for file in $$list; do \
+	    echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
+	    install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
+	  done; \
+	else : ; fi
+
+uninstall-info:
+	$(PRE_UNINSTALL)
+	@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
+	  ii=yes; \
+	else ii=; fi; \
+	list='$(INFO_DEPS)'; \
+	for file in $$list; do \
+	  test -z "$$ii" \
+	    || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
+	done
+	$(NORMAL_UNINSTALL)
+	list='$(INFO_DEPS)'; \
+	for file in $$list; do \
+	  (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
+	done
+
+check: test1.c
+#	$(CC) -g $(srcdir)/test1.c libmmalloc.a
+# This loses for Canadian cross (building mmalloc with a cross-compiler).
+# There is probably some dejagnu-ish solution (such as what we are doing
+# for gdb, perhaps).
+#	./a.out
+
+install:	all install-info
+		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir)
+		$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(TARGETLIB)n
+		$(RANLIB) $(DESTDIR)$(libdir)/$(TARGETLIB)n
+		mv -f $(DESTDIR)$(libdir)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(TARGETLIB)
+
+uninstall:	uninstall-info
+
+$(TARGETLIB):	$(TARGETOBJS)
+		$(RM) -rf $@
+		$(AR) $(AR_FLAGS) $@ $(TARGETOBJS)
+		$(RANLIB) $@
+
+$(OFILES) :	$(HFILES) Makefile
+
+mm.o:		$(HFILES) $(CFILES)
+		$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $(srcdir)/mm.c
+
+.always.:
+# Do nothing.
+
+.PHONEY: all etags tags ls clean stage1 stage2 .always.
+
+stage1:		force
+		-mkdir stage1
+		-mv -f $(STAGESTUFF) stage1
+
+stage2:		force
+		-mkdir stage2
+		-mv -f $(STAGESTUFF) stage2
+
+stage3:		force
+		-mkdir stage3
+		-mv -f $(STAGESTUFF) stage3
+
+stage4:		force
+		-mkdir stage4
+		-mv -f $(STAGESTUFF) stage4
+
+against=stage2
+
+comparison:	force
+		for i in *.o ; do cmp $$i $(against)/$$i || exit 1 ; done
+
+de-stage1:	force
+		-(cd stage1 ; mv -f * ..)
+		-rmdir stage1
+
+de-stage2:	force
+		-(cd stage2 ; mv -f * ..)
+		-rmdir stage2
+
+de-stage3:	force
+		-(cd stage3 ; mv -f * ..)
+		-rmdir stage3
+
+de-stage4:	force
+		-(cd stage4 ; mv -f * ..)
+		-rmdir stage4
+
+etags tags:	TAGS
+
+TAGS:		$(CFILES)
+	etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
+
+ls:
+		@echo Makefile $(HFILES) $(CFILES)
+
+# Need to deal with profiled libraries, too.
+
+mostlyclean clean:
+		rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors 
+
+distclean:	clean 
+		rm -f config.cache config.log config.status
+		rm -f Makefile depend
+
+maintainer-clean realclean: distclean clean
+		@echo "This command is intended for maintainers to use;"
+		@echo "it deletes files that may require special tools to rebuild."
+		rm -f mmalloc.info
+
+force:
+
+Makefile:	Makefile.in config.status
+		$(SHELL) config.status
+
+config.status:	configure
+		$(SHELL) config.status --recheck
diff --git a/mmalloc/TODO b/mmalloc/TODO
new file mode 100644
index 0000000..9412043
--- /dev/null
+++ b/mmalloc/TODO
@@ -0,0 +1,17 @@
+Things that still need attention:
+
+   *	Make implementation changes necessary to allow multiple processes
+	to use the mmalloc managed region simultaneously.  This requires,
+	at the minimum, some sort of cooperative locking that ensures that
+	only one process at a time is changing any of the mmalloc managed
+	data structures (its ok for the mmalloc managed data regions to be
+	changed at any time since we don't care about their contents).
+
+   *	In order to support multiple processes using the mmalloc managed
+	region, the malloc descriptor needs to be broken into two parts,
+	one part which is specific to the given process and is maintained
+	separately on a per process basis, and another part which is common
+	to all processes.  As an example, the file descriptor is specific
+	to a given process, as are the morecore and abortfunc pointers.
+	However magic[], the version number, the flags field, etc are
+	common to all processes.
diff --git a/mmalloc/acinclude.m4 b/mmalloc/acinclude.m4
new file mode 100644
index 0000000..71b09b9
--- /dev/null
+++ b/mmalloc/acinclude.m4
@@ -0,0 +1 @@
+sinclude(../bfd/acinclude.m4)
diff --git a/mmalloc/aclocal.m4 b/mmalloc/aclocal.m4
new file mode 100644
index 0000000..7cf2a1e
--- /dev/null
+++ b/mmalloc/aclocal.m4
@@ -0,0 +1,14 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+sinclude(../bfd/acinclude.m4)
+
diff --git a/mmalloc/attach.c b/mmalloc/attach.c
new file mode 100644
index 0000000..2bd70bf
--- /dev/null
+++ b/mmalloc/attach.c
@@ -0,0 +1,221 @@
+/* Initialization for access to a mmap'd malloc managed region.
+   Copyright 1992, 2000 Free Software Foundation, Inc.
+
+   Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include <sys/types.h>
+#include <fcntl.h> /* After sys/types.h, at least for dpx/2.  */
+#include <sys/stat.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>	/* Prototypes for lseek */
+#endif
+#include "mmprivate.h"
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+
+#if defined(HAVE_MMAP)
+
+/* Forward declarations/prototypes for local functions */
+
+static struct mdesc *reuse PARAMS ((int));
+
+/* Initialize access to a mmalloc managed region.
+
+   If FD is a valid file descriptor for an open file then data for the
+   mmalloc managed region is mapped to that file, otherwise "/dev/zero"
+   is used and the data will not exist in any filesystem object.
+
+   If the open file corresponding to FD is from a previous use of
+   mmalloc and passes some basic sanity checks to ensure that it is
+   compatible with the current mmalloc package, then it's data is
+   mapped in and is immediately accessible at the same addresses in
+   the current process as the process that created the file.
+
+   If BASEADDR is not NULL, the mapping is established starting at the
+   specified address in the process address space.  If BASEADDR is NULL,
+   the mmalloc package chooses a suitable address at which to start the
+   mapped region, which will be the value of the previous mapping if
+   opening an existing file which was previously built by mmalloc, or
+   for new files will be a value chosen by mmap.
+
+   Specifying BASEADDR provides more control over where the regions
+   start and how big they can be before bumping into existing mapped
+   regions or future mapped regions.
+
+   On success, returns a "malloc descriptor" which is used in subsequent
+   calls to other mmalloc package functions.  It is explicitly "void *"
+   ("char *" for systems that don't fully support void) so that users
+   of the package don't have to worry about the actual implementation
+   details.
+
+   On failure returns NULL. */
+
+PTR
+mmalloc_attach (fd, baseaddr)
+  int fd;
+  PTR baseaddr;
+{
+  struct mdesc mtemp;
+  struct mdesc *mdp;
+  PTR mbase;
+  struct stat sbuf;
+
+  /* First check to see if FD is a valid file descriptor, and if so, see
+     if the file has any current contents (size > 0).  If it does, then
+     attempt to reuse the file.  If we can't reuse the file, either
+     because it isn't a valid mmalloc produced file, was produced by an
+     obsolete version, or any other reason, then we fail to attach to
+     this file. */
+
+  if (fd >= 0)
+    {
+      if (fstat (fd, &sbuf) < 0)
+	{
+	  return (NULL);
+	}
+      else if (sbuf.st_size > 0)
+	{
+	  return ((PTR) reuse (fd));
+	}
+    }
+
+  /* We start off with the malloc descriptor allocated on the stack, until
+     we build it up enough to call _mmalloc_mmap_morecore() to allocate the
+     first page of the region and copy it there.  Ensure that it is zero'd and
+     then initialize the fields that we know values for. */
+
+  mdp = &mtemp;
+  memset ((char *) mdp, 0, sizeof (mtemp));
+  strncpy (mdp -> magic, MMALLOC_MAGIC, MMALLOC_MAGIC_SIZE);
+  mdp -> headersize = sizeof (mtemp);
+  mdp -> version = MMALLOC_VERSION;
+  mdp -> morecore = __mmalloc_mmap_morecore;
+  mdp -> fd = fd;
+  mdp -> base = mdp -> breakval = mdp -> top = baseaddr;
+
+  /* If we have not been passed a valid open file descriptor for the file
+     to map to, then open /dev/zero and use that to map to. */
+
+  if (mdp -> fd < 0)
+    {
+      if ((mdp -> fd = open ("/dev/zero", O_RDWR)) < 0)
+	{
+	  return (NULL);
+	}
+      else
+	{
+	  mdp -> flags |= MMALLOC_DEVZERO;
+	}
+    }
+
+  /*  Now try to map in the first page, copy the malloc descriptor structure
+      there, and arrange to return a pointer to this new copy.  If the mapping
+      fails, then close the file descriptor if it was opened by us, and arrange
+      to return a NULL. */
+
+  if ((mbase = mdp -> morecore (mdp, sizeof (mtemp))) != NULL)
+    {
+      memcpy (mbase, mdp, sizeof (mtemp));
+      mdp = (struct mdesc *) mbase;
+    }
+  else
+    {
+      if (mdp -> flags & MMALLOC_DEVZERO)
+	{
+	  close (mdp -> fd);
+	}
+      mdp = NULL;
+    }
+
+  return ((PTR) mdp);
+}
+
+/* Given an valid file descriptor on an open file, test to see if that file
+   is a valid mmalloc produced file, and if so, attempt to remap it into the
+   current process at the same address to which it was previously mapped.
+
+   Note that we have to update the file descriptor number in the malloc-
+   descriptor read from the file to match the current valid one, before
+   trying to map the file in, and again after a successful mapping and
+   after we've switched over to using the mapped in malloc descriptor 
+   rather than the temporary one on the stack.
+
+   Once we've switched over to using the mapped in malloc descriptor, we
+   have to update the pointer to the morecore function, since it almost
+   certainly will be at a different address if the process reusing the
+   mapped region is from a different executable.
+
+   Also note that if the heap being remapped previously used the mmcheckf()
+   routines, we need to update the hooks since their target functions
+   will have certainly moved if the executable has changed in any way.
+   We do this by calling mmcheckf() internally.
+
+   Returns a pointer to the malloc descriptor if successful, or NULL if
+   unsuccessful for some reason. */
+
+static struct mdesc *
+reuse (fd)
+  int fd;
+{
+  struct mdesc mtemp;
+  struct mdesc *mdp = NULL;
+
+  if ((lseek (fd, 0L, SEEK_SET) == 0) &&
+      (read (fd, (char *) &mtemp, sizeof (mtemp)) == sizeof (mtemp)) &&
+      (mtemp.headersize == sizeof (mtemp)) &&
+      (strcmp (mtemp.magic, MMALLOC_MAGIC) == 0) &&
+      (mtemp.version <= MMALLOC_VERSION))
+    {
+      mtemp.fd = fd;
+      if (__mmalloc_remap_core (&mtemp) == mtemp.base)
+	{
+	  mdp = (struct mdesc *) mtemp.base;
+	  mdp -> fd = fd;
+	  mdp -> morecore = __mmalloc_mmap_morecore;
+	  if (mdp -> mfree_hook != NULL)
+	    {
+	      mmcheckf ((PTR) mdp, (void (*) PARAMS ((void))) NULL, 1);
+	    }
+	}
+    }
+  return (mdp);
+}
+
+#else	/* !defined (HAVE_MMAP) */
+
+/* For systems without mmap, the library still supplies an entry point
+   to link to, but trying to initialize access to an mmap'd managed region
+   always fails. */
+
+/* ARGSUSED */
+PTR
+mmalloc_attach (fd, baseaddr)
+  int fd;
+  PTR baseaddr;
+{
+   return (NULL);
+}
+
+#endif	/* defined (HAVE_MMAP) */
+
diff --git a/mmalloc/configure b/mmalloc/configure
new file mode 100755
index 0000000..8420dfa
--- /dev/null
+++ b/mmalloc/configure
@@ -0,0 +1,1747 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+sitefile=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --site-file=FILE        use FILE as the site file
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -site-file | --site-file | --site-fil | --site-fi | --site-f)
+    ac_prev=sitefile ;;
+  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+    sitefile="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=mmalloc.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$sitefile"; then
+  if test -z "$CONFIG_SITE"; then
+    if test "x$prefix" != xNONE; then
+      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+    else
+      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+    fi
+  fi
+else
+  CONFIG_SITE="$sitefile"
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:540: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:570: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:621: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:653: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 664 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:695: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:700: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:728: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:790: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:849: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:870: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:896: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="${ac_tool_prefix}ar"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:928: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:960: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:994: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1009 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1026 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1043 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1077: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1082 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1087: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1116: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1121 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:1169: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1177 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+	mmap private not fixed
+	mmap private fixed at somewhere currently unmapped
+	mmap private fixed at somewhere already mapped
+	mmap shared not fixed
+	mmap shared fixed at somewhere currently unmapped
+	mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the filesystem buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h.  */
+# ifndef HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192	/* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+	char *data, *data2, *data3;
+	int i, pagesize;
+	int fd;
+
+	pagesize = getpagesize();
+
+	/*
+	 * First, make a file with some known garbage in it.
+	 */
+	data = malloc(pagesize);
+	if (!data)
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		*(data + i) = rand();
+	umask(0);
+	fd = creat("conftestmmap", 0600);
+	if (fd < 0)
+		exit(1);
+	if (write(fd, data, pagesize) != pagesize)
+		exit(1);
+	close(fd);
+
+	/*
+	 * Next, try to mmap the file at a fixed address which
+	 * already has something else allocated at it.  If we can,
+	 * also make sure that we see the same garbage.
+	 */
+	fd = open("conftestmmap", O_RDWR);
+	if (fd < 0)
+		exit(1);
+	data2 = malloc(2 * pagesize);
+	if (!data2)
+		exit(1);
+	data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+	if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+	    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		if (*(data + i) != *(data2 + i))
+			exit(1);
+
+	/*
+	 * Finally, make sure that changes to the mapped area
+	 * do not percolate back to the file as seen by read().
+	 * (This is a bug on some variants of i386 svr4.0.)
+	 */
+	for (i = 0; i < pagesize; ++i)
+		*(data2 + i) = *(data2 + i) + 1;
+	data3 = malloc(pagesize);
+	if (!data3)
+		exit(1);
+	if (read(fd, data3, pagesize) != pagesize)
+		exit(1);
+	for (i = 0; i < pagesize; ++i)
+		if (*(data + i) != *(data3 + i))
+			exit(1);
+	close(fd);
+	unlink("conftestmmap");
+	exit(0);
+}
+
+EOF
+if { (eval echo configure:1317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+for ac_hdr in limits.h stddef.h unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1343: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1348 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
+echo "configure:1381: checking whether sbrk must be declared" >&5
+if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1386 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int main() {
+char *(*pfn) = (char *(*)) sbrk
+; return 0; }
+EOF
+if { (eval echo configure:1407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_decl_needed_sbrk=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_decl_needed_sbrk=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bfd_cv_decl_needed_sbrk" 1>&6
+if test $bfd_cv_decl_needed_sbrk = yes; then
+  cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_SBRK 1
+EOF
+
+fi
+
+echo $ac_n "checking whether getpagesize must be declared""... $ac_c" 1>&6
+echo "configure:1428: checking whether getpagesize must be declared" >&5
+if eval "test \"`echo '$''{'bfd_cv_decl_needed_getpagesize'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1433 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int main() {
+char *(*pfn) = (char *(*)) getpagesize
+; return 0; }
+EOF
+if { (eval echo configure:1454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_decl_needed_getpagesize=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_decl_needed_getpagesize=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bfd_cv_decl_needed_getpagesize" 1>&6
+if test $bfd_cv_decl_needed_getpagesize = yes; then
+  cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_GETPAGESIZE 1
+EOF
+
+fi
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/mmalloc/configure.in b/mmalloc/configure.in
new file mode 100644
index 0000000..db7a4c2
--- /dev/null
+++ b/mmalloc/configure.in
@@ -0,0 +1,35 @@
+dnl Autoconf configure script for MMALLOC, the GNU mmemory allocator.
+dnl Copyright 2000 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GDB.
+dnl 
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.12.1)dnl
+AC_INIT(mmalloc.c)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_FUNC_MMAP
+AC_CHECK_HEADERS(limits.h stddef.h unistd.h)
+
+BFD_NEED_DECLARATION(sbrk)
+BFD_NEED_DECLARATION(getpagesize)
+
+AC_OUTPUT(Makefile)
diff --git a/mmalloc/detach.c b/mmalloc/detach.c
new file mode 100644
index 0000000..1780679
--- /dev/null
+++ b/mmalloc/detach.c
@@ -0,0 +1,71 @@
+/* Finish access to a mmap'd malloc managed region.
+   Copyright 1992 Free Software Foundation, Inc.
+
+   Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include <sys/types.h>
+#include "mmprivate.h"
+
+/* Terminate access to a mmalloc managed region by unmapping all memory pages
+   associated with the region, and closing the file descriptor if it is one
+   that we opened.
+
+   Returns NULL on success.
+
+   Returns the malloc descriptor on failure, which can subsequently be used
+   for further action, such as obtaining more information about the nature of
+   the failure by examining the preserved errno value.
+
+   Note that the malloc descriptor that we are using is currently located in
+   region we are about to unmap, so we first make a local copy of it on the
+   stack and use the copy. */
+
+PTR
+mmalloc_detach (md)
+     PTR md;
+{
+  struct mdesc mtemp;
+
+  if (md != NULL)
+    {
+
+      mtemp = *(struct mdesc *) md;
+      
+      /* Now unmap all the pages associated with this region by asking for a
+	 negative increment equal to the current size of the region. */
+      
+      if ((mtemp.morecore (&mtemp, mtemp.base - mtemp.breakval)) == NULL)
+	{
+	  /* Deallocating failed.  Update the original malloc descriptor
+	     with any changes */
+	  *(struct mdesc *) md = mtemp;
+	}
+      else
+	{
+	  if (mtemp.flags & MMALLOC_DEVZERO)
+	    {
+	      close (mtemp.fd);
+	    }
+	  md = NULL;
+	}
+    }
+
+  return (md);
+}
diff --git a/mmalloc/keys.c b/mmalloc/keys.c
new file mode 100644
index 0000000..35f00d1
--- /dev/null
+++ b/mmalloc/keys.c
@@ -0,0 +1,66 @@
+/* Access for application keys in mmap'd malloc managed region.
+   Copyright 1992 Free Software Foundation, Inc.
+
+   Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* This module provides access to some keys that the application can use to
+   provide persistent access to locations in the mapped memory section.
+   The intent is that these keys are to be used sparingly as sort of
+   persistent global variables which the application can use to reinitialize
+   access to data in the mapped region.
+
+   For the moment, these keys are simply stored in the malloc descriptor
+   itself, in an array of fixed length.  This should be fixed so that there
+   can be an unlimited number of keys, possibly using a multilevel access
+   scheme of some sort. */
+
+#include "mmprivate.h"
+
+int
+mmalloc_setkey (md, keynum, key)
+  PTR md;     
+  int keynum;
+  PTR key;
+{
+  struct mdesc *mdp = (struct mdesc *) md;
+  int result = 0;
+
+  if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
+    {
+      mdp -> keys [keynum] = key;
+      result++;
+    }
+  return (result);
+}
+
+PTR
+mmalloc_getkey (md, keynum)
+  PTR md;     
+  int keynum;
+{
+  struct mdesc *mdp = (struct mdesc *) md;
+  PTR keyval = NULL;
+
+  if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
+    {
+      keyval = mdp -> keys [keynum];
+    }
+  return (keyval);
+}
diff --git a/mmalloc/mcalloc.c b/mmalloc/mcalloc.c
new file mode 100644
index 0000000..c9fcc07
--- /dev/null
+++ b/mmalloc/mcalloc.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include <sys/types.h>  /* GCC on HP/UX needs this before string.h. */
+#include <string.h>	/* Prototypes for memcpy, memmove, memset, etc */
+
+#include "mmprivate.h"
+
+/* Allocate an array of NMEMB elements each SIZE bytes long.
+   The entire array is initialized to zeros.  */
+
+PTR
+mcalloc (md, nmemb, size)
+  PTR md;
+  register size_t nmemb;
+  register size_t size;
+{
+  register PTR result;
+
+  if ((result = mmalloc (md, nmemb * size)) != NULL)
+    {
+      memset (result, 0, nmemb * size);
+    }
+  return (result);
+}
+
+/* When using this package, provide a version of malloc/realloc/free built
+   on top of it, so that if we use the default sbrk() region we will not
+   collide with another malloc package trying to do the same thing, if
+   the application contains any "hidden" calls to malloc/realloc/free (such
+   as inside a system library). */
+
+PTR
+calloc (nmemb, size)
+  size_t nmemb;
+  size_t size;
+{
+  return (mcalloc ((PTR) NULL, nmemb, size));
+}
diff --git a/mmalloc/mfree.c b/mmalloc/mfree.c
new file mode 100644
index 0000000..c509ac6
--- /dev/null
+++ b/mmalloc/mfree.c
@@ -0,0 +1,247 @@
+/* Free a block of memory allocated by `mmalloc'.
+   Copyright 1990, 1991, 1992 Free Software Foundation
+
+   Written May 1989 by Mike Haertel.
+   Heavily modified Mar 1992 by Fred Fish.  (fnf@cygnus.com)
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+#include "mmprivate.h"
+
+/* Return memory to the heap.
+   Like `mfree' but don't call a mfree_hook if there is one.  */
+
+void
+__mmalloc_free (mdp, ptr)
+  struct mdesc *mdp;
+  PTR ptr;
+{
+  int type;
+  size_t block, blocks;
+  register size_t i;
+  struct list *prev, *next;
+
+  block = BLOCK (ptr);
+
+  type = mdp -> heapinfo[block].busy.type;
+  switch (type)
+    {
+    case 0:
+      /* Get as many statistics as early as we can.  */
+      mdp -> heapstats.chunks_used--;
+      mdp -> heapstats.bytes_used -=
+	  mdp -> heapinfo[block].busy.info.size * BLOCKSIZE;
+      mdp -> heapstats.bytes_free +=
+	  mdp -> heapinfo[block].busy.info.size * BLOCKSIZE;
+
+      /* Find the free cluster previous to this one in the free list.
+	 Start searching at the last block referenced; this may benefit
+	 programs with locality of allocation.  */
+      i = mdp -> heapindex;
+      if (i > block)
+	{
+	  while (i > block)
+	    {
+	      i = mdp -> heapinfo[i].free.prev;
+	    }
+	}
+      else
+	{
+	  do
+	    {
+	      i = mdp -> heapinfo[i].free.next;
+	    }
+	  while ((i != 0) && (i < block));
+	  i = mdp -> heapinfo[i].free.prev;
+	}
+
+      /* Determine how to link this block into the free list.  */
+      if (block == i + mdp -> heapinfo[i].free.size)
+	{
+	  /* Coalesce this block with its predecessor.  */
+	  mdp -> heapinfo[i].free.size +=
+	    mdp -> heapinfo[block].busy.info.size;
+	  block = i;
+	}
+      else
+	{
+	  /* Really link this block back into the free list.  */
+	  mdp -> heapinfo[block].free.size =
+	    mdp -> heapinfo[block].busy.info.size;
+	  mdp -> heapinfo[block].free.next = mdp -> heapinfo[i].free.next;
+	  mdp -> heapinfo[block].free.prev = i;
+	  mdp -> heapinfo[i].free.next = block;
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.prev = block;
+	  mdp -> heapstats.chunks_free++;
+	}
+
+      /* Now that the block is linked in, see if we can coalesce it
+	 with its successor (by deleting its successor from the list
+	 and adding in its size).  */
+      if (block + mdp -> heapinfo[block].free.size ==
+	  mdp -> heapinfo[block].free.next)
+	{
+	  mdp -> heapinfo[block].free.size
+	    += mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.size;
+	  mdp -> heapinfo[block].free.next
+	    = mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.next;
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.prev = block;
+	  mdp -> heapstats.chunks_free--;
+	}
+
+      /* Now see if we can return stuff to the system.  */
+      blocks = mdp -> heapinfo[block].free.size;
+      if (blocks >= FINAL_FREE_BLOCKS && block + blocks == mdp -> heaplimit
+	  && mdp -> morecore (mdp, 0) == ADDRESS (block + blocks))
+	{
+	  register size_t bytes = blocks * BLOCKSIZE;
+	  mdp -> heaplimit -= blocks;
+	  mdp -> morecore (mdp, -bytes);
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.prev].free.next
+	    = mdp -> heapinfo[block].free.next;
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.prev
+	    = mdp -> heapinfo[block].free.prev;
+	  block = mdp -> heapinfo[block].free.prev;
+	  mdp -> heapstats.chunks_free--;
+	  mdp -> heapstats.bytes_free -= bytes;
+	}
+
+      /* Set the next search to begin at this block.  */
+      mdp -> heapindex = block;
+      break;
+
+    default:
+      /* Do some of the statistics.  */
+      mdp -> heapstats.chunks_used--;
+      mdp -> heapstats.bytes_used -= 1 << type;
+      mdp -> heapstats.chunks_free++;
+      mdp -> heapstats.bytes_free += 1 << type;
+
+      /* Get the address of the first free fragment in this block.  */
+      prev = (struct list *)
+	((char *) ADDRESS(block) +
+	 (mdp -> heapinfo[block].busy.info.frag.first << type));
+
+      if (mdp -> heapinfo[block].busy.info.frag.nfree ==
+	  (BLOCKSIZE >> type) - 1)
+	{
+	  /* If all fragments of this block are free, remove them
+	     from the fragment list and free the whole block.  */
+	  next = prev;
+	  for (i = 1; i < (size_t) (BLOCKSIZE >> type); ++i)
+	    {
+	      next = next -> next;
+	    }
+	  prev -> prev -> next = next;
+	  if (next != NULL)
+	    {
+	      next -> prev = prev -> prev;
+	    }
+	  mdp -> heapinfo[block].busy.type = 0;
+	  mdp -> heapinfo[block].busy.info.size = 1;
+
+	  /* Keep the statistics accurate.  */
+	  mdp -> heapstats.chunks_used++;
+	  mdp -> heapstats.bytes_used += BLOCKSIZE;
+	  mdp -> heapstats.chunks_free -= BLOCKSIZE >> type;
+	  mdp -> heapstats.bytes_free -= BLOCKSIZE;
+
+	  mfree ((PTR) mdp, (PTR) ADDRESS(block));
+	}
+      else if (mdp -> heapinfo[block].busy.info.frag.nfree != 0)
+	{
+	  /* If some fragments of this block are free, link this
+	     fragment into the fragment list after the first free
+	     fragment of this block. */
+	  next = (struct list *) ptr;
+	  next -> next = prev -> next;
+	  next -> prev = prev;
+	  prev -> next = next;
+	  if (next -> next != NULL)
+	    {
+	      next -> next -> prev = next;
+	    }
+	  ++mdp -> heapinfo[block].busy.info.frag.nfree;
+	}
+      else
+	{
+	  /* No fragments of this block are free, so link this
+	     fragment into the fragment list and announce that
+	     it is the first free fragment of this block. */
+	  prev = (struct list *) ptr;
+	  mdp -> heapinfo[block].busy.info.frag.nfree = 1;
+	  mdp -> heapinfo[block].busy.info.frag.first =
+	    RESIDUAL (ptr, BLOCKSIZE) >> type;
+	  prev -> next = mdp -> fraghead[type].next;
+	  prev -> prev = &mdp -> fraghead[type];
+	  prev -> prev -> next = prev;
+	  if (prev -> next != NULL)
+	    {
+	      prev -> next -> prev = prev;
+	    }
+	}
+      break;
+    }
+}
+
+/* Return memory to the heap.  */
+
+void
+mfree (md, ptr)
+  PTR md;
+  PTR ptr;
+{
+  struct mdesc *mdp;
+  register struct alignlist *l;
+
+  if (ptr != NULL)
+    {
+      mdp = MD_TO_MDP (md);
+      for (l = mdp -> aligned_blocks; l != NULL; l = l -> next)
+	{
+	  if (l -> aligned == ptr)
+	    {
+	      l -> aligned = NULL;  /* Mark the slot in the list as free. */
+	      ptr = l -> exact;
+	      break;
+	    }
+	}      
+      if (mdp -> mfree_hook != NULL)
+	{
+	  (*mdp -> mfree_hook) (md, ptr);
+	}
+      else
+	{
+	  __mmalloc_free (mdp, ptr);
+	}
+    }
+}
+
+/* When using this package, provide a version of malloc/realloc/free built
+   on top of it, so that if we use the default sbrk() region we will not
+   collide with another malloc package trying to do the same thing, if
+   the application contains any "hidden" calls to malloc/realloc/free (such
+   as inside a system library). */
+
+void
+free (ptr)
+  PTR ptr;
+{
+  mfree ((PTR) NULL, ptr);
+}
diff --git a/mmalloc/mm.c b/mmalloc/mm.c
new file mode 100644
index 0000000..d487e0c
--- /dev/null
+++ b/mmalloc/mm.c
@@ -0,0 +1,40 @@
+/* Build the entire mmalloc library as a single object module. This
+   avoids having clients pick up part of their allocation routines
+   from mmalloc and part from libc, which results in undefined
+   behavior.  It should also still be possible to build the library
+   as a standard library with multiple objects.
+
+   Copyright 1996, 2000 Free Software Foundation
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>	/* Prototypes for lseek, sbrk (maybe) */
+#endif
+#include "mcalloc.c"
+#include "mfree.c"
+#include "mmalloc.c"
+#include "mmcheck.c"
+#include "mmemalign.c"
+#include "mmstats.c"
+#include "mmtrace.c"
+#include "mrealloc.c"
+#include "mvalloc.c"
+#include "mmap-sup.c"
+#include "attach.c"
+#include "detach.c"
+#include "keys.c"
+#include "sbrk-sup.c"
diff --git a/mmalloc/mmalloc.c b/mmalloc/mmalloc.c
new file mode 100644
index 0000000..7c60fe2
--- /dev/null
+++ b/mmalloc/mmalloc.c
@@ -0,0 +1,337 @@
+/* Memory allocator `malloc'.
+   Copyright 1990, 1991, 1992 Free Software Foundation
+
+   Written May 1989 by Mike Haertel.
+   Heavily modified Mar 1992 by Fred Fish for mmap'd version.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+#include <string.h>	/* Prototypes for memcpy, memmove, memset, etc */
+
+#include "mmprivate.h"
+
+/* Prototypes for local functions */
+
+static int initialize PARAMS ((struct mdesc *));
+static PTR morecore PARAMS ((struct mdesc *, size_t));
+static PTR align PARAMS ((struct mdesc *, size_t));
+
+/* Aligned allocation.  */
+
+static PTR
+align (mdp, size)
+  struct mdesc *mdp;
+  size_t size;
+{
+  PTR result;
+  unsigned long int adj;
+
+  result = mdp -> morecore (mdp, size);
+  adj = RESIDUAL (result, BLOCKSIZE);
+  if (adj != 0)
+    {
+      adj = BLOCKSIZE - adj;
+      mdp -> morecore (mdp, adj);
+      result = (char *) result + adj;
+    }
+  return (result);
+}
+
+/* Set everything up and remember that we have.  */
+
+static int
+initialize (mdp)
+  struct mdesc *mdp;
+{
+  mdp -> heapsize = HEAP / BLOCKSIZE;
+  mdp -> heapinfo = (malloc_info *) 
+    align (mdp, mdp -> heapsize * sizeof (malloc_info));
+  if (mdp -> heapinfo == NULL)
+    {
+      return (0);
+    }
+  memset ((PTR)mdp -> heapinfo, 0, mdp -> heapsize * sizeof (malloc_info));
+  mdp -> heapinfo[0].free.size = 0;
+  mdp -> heapinfo[0].free.next = mdp -> heapinfo[0].free.prev = 0;
+  mdp -> heapindex = 0;
+  mdp -> heapbase = (char *) mdp -> heapinfo;
+  mdp -> flags |= MMALLOC_INITIALIZED;
+  return (1);
+}
+
+/* Get neatly aligned memory, initializing or
+   growing the heap info table as necessary. */
+
+static PTR
+morecore (mdp, size)
+  struct mdesc *mdp;
+  size_t size;
+{
+  PTR result;
+  malloc_info *newinfo, *oldinfo;
+  size_t newsize;
+
+  result = align (mdp, size);
+  if (result == NULL)
+    {
+      return (NULL);
+    }
+
+  /* Check if we need to grow the info table.  */
+  if ((size_t) BLOCK ((char *) result + size) > mdp -> heapsize)
+    {
+      newsize = mdp -> heapsize;
+      while ((size_t) BLOCK ((char *) result + size) > newsize)
+	{
+	  newsize *= 2;
+	}
+      newinfo = (malloc_info *) align (mdp, newsize * sizeof (malloc_info));
+      if (newinfo == NULL)
+	{
+	  mdp -> morecore (mdp, -size);
+	  return (NULL);
+	}
+      memset ((PTR) newinfo, 0, newsize * sizeof (malloc_info));
+      memcpy ((PTR) newinfo, (PTR) mdp -> heapinfo,
+	      mdp -> heapsize * sizeof (malloc_info));
+      oldinfo = mdp -> heapinfo;
+      newinfo[BLOCK (oldinfo)].busy.type = 0;
+      newinfo[BLOCK (oldinfo)].busy.info.size
+	= BLOCKIFY (mdp -> heapsize * sizeof (malloc_info));
+      mdp -> heapinfo = newinfo;
+      __mmalloc_free (mdp, (PTR)oldinfo);
+      mdp -> heapsize = newsize;
+    }
+
+  mdp -> heaplimit = BLOCK ((char *) result + size);
+  return (result);
+}
+
+/* Allocate memory from the heap.  */
+
+PTR
+mmalloc (md, size)
+  PTR md;
+  size_t size;
+{
+  struct mdesc *mdp;
+  PTR result;
+  size_t block, blocks, lastblocks, start;
+  register size_t i;
+  struct list *next;
+  register size_t log;
+
+  if (size == 0)
+    {
+      return (NULL);
+    }
+
+  mdp = MD_TO_MDP (md);
+      
+  if (mdp -> mmalloc_hook != NULL)
+    {
+      return ((*mdp -> mmalloc_hook) (md, size));
+    }
+
+  if (!(mdp -> flags & MMALLOC_INITIALIZED))
+    {
+      if (!initialize (mdp))
+	{
+	  return (NULL);
+	}
+    }
+
+  if (size < sizeof (struct list))
+    {
+      size = sizeof (struct list);
+    }
+
+  /* Determine the allocation policy based on the request size.  */
+  if (size <= BLOCKSIZE / 2)
+    {
+      /* Small allocation to receive a fragment of a block.
+	 Determine the logarithm to base two of the fragment size. */
+      log = 1;
+      --size;
+      while ((size /= 2) != 0)
+	{
+	  ++log;
+	}
+
+      /* Look in the fragment lists for a
+	 free fragment of the desired size. */
+      next = mdp -> fraghead[log].next;
+      if (next != NULL)
+	{
+	  /* There are free fragments of this size.
+	     Pop a fragment out of the fragment list and return it.
+	     Update the block's nfree and first counters. */
+	  result = (PTR) next;
+	  next -> prev -> next = next -> next;
+	  if (next -> next != NULL)
+	    {
+	      next -> next -> prev = next -> prev;
+	    }
+	  block = BLOCK (result);
+	  if (--mdp -> heapinfo[block].busy.info.frag.nfree != 0)
+	    {
+	      mdp -> heapinfo[block].busy.info.frag.first =
+		RESIDUAL (next -> next, BLOCKSIZE) >> log;
+	    }
+
+	  /* Update the statistics.  */
+	  mdp -> heapstats.chunks_used++;
+	  mdp -> heapstats.bytes_used += 1 << log;
+	  mdp -> heapstats.chunks_free--;
+	  mdp -> heapstats.bytes_free -= 1 << log;
+	}
+      else
+	{
+	  /* No free fragments of the desired size, so get a new block
+	     and break it into fragments, returning the first.  */
+	  result = mmalloc (md, BLOCKSIZE);
+	  if (result == NULL)
+	    {
+	      return (NULL);
+	    }
+
+	  /* Link all fragments but the first into the free list.  */
+	  for (i = 1; i < (size_t) (BLOCKSIZE >> log); ++i)
+	    {
+	      next = (struct list *) ((char *) result + (i << log));
+	      next -> next = mdp -> fraghead[log].next;
+	      next -> prev = &mdp -> fraghead[log];
+	      next -> prev -> next = next;
+	      if (next -> next != NULL)
+		{
+		  next -> next -> prev = next;
+		}
+	    }
+
+	  /* Initialize the nfree and first counters for this block.  */
+	  block = BLOCK (result);
+	  mdp -> heapinfo[block].busy.type = log;
+	  mdp -> heapinfo[block].busy.info.frag.nfree = i - 1;
+	  mdp -> heapinfo[block].busy.info.frag.first = i - 1;
+
+	  mdp -> heapstats.chunks_free += (BLOCKSIZE >> log) - 1;
+	  mdp -> heapstats.bytes_free += BLOCKSIZE - (1 << log);
+ 	  mdp -> heapstats.bytes_used -= BLOCKSIZE - (1 << log);
+	}
+    }
+  else
+    {
+      /* Large allocation to receive one or more blocks.
+	 Search the free list in a circle starting at the last place visited.
+	 If we loop completely around without finding a large enough
+	 space we will have to get more memory from the system.  */
+      blocks = BLOCKIFY(size);
+      start = block = MALLOC_SEARCH_START;
+      while (mdp -> heapinfo[block].free.size < blocks)
+	{
+	  block = mdp -> heapinfo[block].free.next;
+	  if (block == start)
+	    {
+	      /* Need to get more from the system.  Check to see if
+		 the new core will be contiguous with the final free
+		 block; if so we don't need to get as much.  */
+	      block = mdp -> heapinfo[0].free.prev;
+	      lastblocks = mdp -> heapinfo[block].free.size;
+	      if (mdp -> heaplimit != 0 &&
+		  block + lastblocks == mdp -> heaplimit &&
+		  mdp -> morecore (mdp, 0) == ADDRESS(block + lastblocks) &&
+		  (morecore (mdp, (blocks - lastblocks) * BLOCKSIZE)) != NULL)
+		{
+		  /* Which block we are extending (the `final free
+		     block' referred to above) might have changed, if
+		     it got combined with a freed info table.  */
+		  block = mdp -> heapinfo[0].free.prev;
+
+		  mdp -> heapinfo[block].free.size += (blocks - lastblocks);
+		  mdp -> heapstats.bytes_free +=
+		      (blocks - lastblocks) * BLOCKSIZE;
+		  continue;
+		}
+	      result = morecore(mdp, blocks * BLOCKSIZE);
+	      if (result == NULL)
+		{
+		  return (NULL);
+		}
+	      block = BLOCK (result);
+	      mdp -> heapinfo[block].busy.type = 0;
+	      mdp -> heapinfo[block].busy.info.size = blocks;
+	      mdp -> heapstats.chunks_used++;
+	      mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
+	      return (result);
+	    }
+	}
+
+      /* At this point we have found a suitable free list entry.
+	 Figure out how to remove what we need from the list. */
+      result = ADDRESS(block);
+      if (mdp -> heapinfo[block].free.size > blocks)
+	{
+	  /* The block we found has a bit left over,
+	     so relink the tail end back into the free list. */
+	  mdp -> heapinfo[block + blocks].free.size
+	    = mdp -> heapinfo[block].free.size - blocks;
+	  mdp -> heapinfo[block + blocks].free.next
+	    = mdp -> heapinfo[block].free.next;
+	  mdp -> heapinfo[block + blocks].free.prev
+	    = mdp -> heapinfo[block].free.prev;
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.prev].free.next
+	    = mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.prev
+	      = mdp -> heapindex = block + blocks;
+	}
+      else
+	{
+	  /* The block exactly matches our requirements,
+	     so just remove it from the list. */
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.next].free.prev
+	    = mdp -> heapinfo[block].free.prev;
+	  mdp -> heapinfo[mdp -> heapinfo[block].free.prev].free.next
+	    = mdp -> heapindex = mdp -> heapinfo[block].free.next;
+	  mdp -> heapstats.chunks_free--;
+	}
+
+      mdp -> heapinfo[block].busy.type = 0;
+      mdp -> heapinfo[block].busy.info.size = blocks;
+      mdp -> heapstats.chunks_used++;
+      mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
+      mdp -> heapstats.bytes_free -= blocks * BLOCKSIZE;
+    }
+
+  return (result);
+}
+
+/* When using this package, provide a version of malloc/realloc/free built
+   on top of it, so that if we use the default sbrk() region we will not
+   collide with another malloc package trying to do the same thing, if
+   the application contains any "hidden" calls to malloc/realloc/free (such
+   as inside a system library). */
+
+PTR
+malloc (size)
+  size_t size;
+{
+  PTR result;
+
+  result = mmalloc ((PTR) NULL, size);
+  return (result);
+}
diff --git a/mmalloc/mmalloc.h b/mmalloc/mmalloc.h
new file mode 100644
index 0000000..082547e
--- /dev/null
+++ b/mmalloc/mmalloc.h
@@ -0,0 +1,62 @@
+#ifndef MMALLOC_H
+#define MMALLOC_H 1
+
+#ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+#else
+#  include <sys/types.h>   /* for size_t */
+#  include <stdio.h>       /* for NULL */
+#endif
+
+#include "ansidecl.h"
+ 
+/* Allocate SIZE bytes of memory.  */
+
+extern PTR mmalloc PARAMS ((PTR, size_t));
+
+/* Re-allocate the previously allocated block in PTR, making the new block
+   SIZE bytes long.  */
+
+extern PTR mrealloc PARAMS ((PTR, PTR, size_t));
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+
+extern PTR mcalloc PARAMS ((PTR, size_t, size_t));
+
+/* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'.  */
+
+extern void mfree PARAMS ((PTR, PTR));
+
+/* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
+
+extern PTR mmemalign PARAMS ((PTR, size_t, size_t));
+
+/* Allocate SIZE bytes on a page boundary.  */
+
+extern PTR mvalloc PARAMS ((PTR, size_t));
+
+/* Activate a standard collection of debugging hooks.  */
+
+extern int mmcheck PARAMS ((PTR, void (*) (void)));
+
+extern int mmcheckf PARAMS ((PTR, void (*) (void), int));
+
+/* Pick up the current statistics. (see FIXME elsewhere) */
+
+extern struct mstats mmstats PARAMS ((PTR));
+
+extern PTR mmalloc_attach PARAMS ((int, PTR));
+
+extern PTR mmalloc_detach PARAMS ((PTR));
+
+extern int mmalloc_setkey PARAMS ((PTR, int, PTR));
+
+extern PTR mmalloc_getkey PARAMS ((PTR, int));
+
+extern int mmalloc_errno PARAMS ((PTR));
+
+extern int mmtrace PARAMS ((void));
+
+extern PTR mmalloc_findbase PARAMS ((int));
+
+#endif  /* MMALLOC_H */
diff --git a/mmalloc/mmalloc.texi b/mmalloc/mmalloc.texi
new file mode 100644
index 0000000..c038f65
--- /dev/null
+++ b/mmalloc/mmalloc.texi
@@ -0,0 +1,258 @@
+\input texinfo  @c                                  -*- Texinfo -*-
+@setfilename mmalloc.info
+
+@ifinfo
+@format
+START-INFO-DIR-ENTRY
+* Mmalloc: (mmalloc).		The GNU mapped-malloc package.
+END-INFO-DIR-ENTRY
+@end format
+
+This file documents the GNU mmalloc (mapped-malloc) package, written by
+fnf@@cygnus.com, based on GNU malloc written by mike@@ai.mit.edu.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+@ignore
+Permission is granted to process this file through Tex and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual).
+
+@end ignore
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided also that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions.
+@end ifinfo
+@iftex
+@c @finalout
+@setchapternewpage odd
+@settitle MMALLOC, the GNU memory-mapped malloc package
+@titlepage
+@title mmalloc
+@subtitle The GNU memory-mapped malloc package
+@author Fred Fish
+@author Cygnus Support
+@author Mike Haertel
+@author Free Software Foundation
+@page
+
+@tex
+\def\$#1${{#1}}  % Kluge: collect RCS revision info without $...$
+\xdef\manvers{\$Revision$}  % For use in headers, footers too
+{\parskip=0pt
+\hfill Cygnus Support\par
+\hfill fnf\@cygnus.com\par
+\hfill {\it MMALLOC, the GNU memory-mapped malloc package}, \manvers\par
+\hfill \TeX{}info \texinfoversion\par
+}
+@end tex
+
+@vskip 0pt plus 1filll
+Copyright @copyright{} 1992 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided also that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions.
+@end titlepage
+@end iftex
+
+@ifinfo
+@node Top, Overview, (dir), (dir)
+@top mmalloc
+This file documents the GNU memory-mapped malloc package mmalloc.
+
+@menu
+* Overview::                    Overall Description
+* Implementation::              Implementation
+
+ --- The Detailed Node Listing ---
+
+Implementation
+
+* Compatibility::               Backwards Compatibility
+* Functions::                   Function Descriptions
+@end menu
+
+@end ifinfo
+
+@node Overview, Implementation, Top, Top
+@chapter Overall Description
+
+This is a heavily modified version of GNU @code{malloc}.  It uses
+@code{mmap} as the basic mechanism for obtaining memory from the
+system, rather than @code{sbrk}.  This gives it several advantages over the
+more traditional malloc:
+
+@itemize @bullet
+@item
+Several different heaps can be used, each of them growing
+or shinking under control of @code{mmap}, with the @code{mmalloc} functions
+using a specific heap on a call by call basis.
+
+@item
+By using @code{mmap}, it is easy to create heaps which are intended to
+be persistent and exist as a filesystem object after the creating
+process has gone away.
+
+@item
+Because multiple heaps can be managed, data used for a 
+specific purpose can be allocated into its own heap, making
+it easier to allow applications to ``dump'' and ``restore'' initialized
+malloc-managed memory regions.  For example, the ``unexec'' hack popularized
+by GNU Emacs could potentially go away.
+@end itemize
+
+@node Implementation,  , Overview, Top
+@chapter Implementation
+
+The @code{mmalloc} functions contain no internal static state.  All
+@code{mmalloc} internal data is allocated in the mapped in region, along
+with the user data that it manages.  This allows it to manage multiple
+such regions and to ``pick up where it left off'' when such regions are
+later dynamically mapped back in.
+
+In some sense, malloc has been ``purified'' to contain no internal state
+information and generalized to use multiple memory regions rather than a
+single region managed by @code{sbrk}.  However the new routines now need an
+extra parameter which informs @code{mmalloc} which memory region it is dealing
+with (along with other information).  This parameter is called the
+@dfn{malloc descriptor}.
+
+The functions initially provided by @code{mmalloc} are:
+
+@example
+void *mmalloc_attach (int fd, void *baseaddr);
+void *mmalloc_detach (void *md);
+int mmalloc_errno (void *md);
+int mmalloc_setkey (void *md, int keynum, void *key);
+void *mmalloc_getkey (void *md, int keynum);
+
+void *mmalloc (void *md, size_t size);
+void *mrealloc (void *md, void *ptr, size_t size);
+void *mvalloc (void *md, size_t size);
+void mfree (void *md, void *ptr);
+@end example
+
+@menu
+* Compatibility::               Backwards Compatibility
+* Functions::                   Function Descriptions
+@end menu
+
+@node Compatibility, Functions, Implementation, Implementation
+@section Backwards Compatibility
+
+To allow a single malloc package to be used in a given application,
+provision is made for the traditional @code{malloc}, @code{realloc}, and
+@code{free} functions to be implemented as special cases of the
+@code{mmalloc} functions.  In particular, if any of the functions that
+expect malloc descriptors are called with a @code{NULL} pointer rather than a
+valid malloc descriptor, then they default to using an @code{sbrk} managed
+region.
+The @code{mmalloc} package provides compatible @code{malloc}, @code{realloc},
+and @code{free} functions using this mechanism internally.
+Applications can avoid this extra interface layer by simply including the
+following defines:
+
+@example
+#define malloc(size)		mmalloc ((void *)0, (size))
+#define realloc(ptr,size)	mrealloc ((void *)0, (ptr), (size));
+#define free(ptr)		mfree ((void *)0, (ptr))
+@end example
+
+@noindent
+or replace the existing @code{malloc}, @code{realloc}, and @code{free}
+calls with the above patterns if using @code{#define} causes problems.
+
+@node Functions,  , Compatibility, Implementation
+@section Function Descriptions
+
+These are the details on the functions that make up the @code{mmalloc}
+package. 
+
+@table @code
+@item void *mmalloc_attach (int @var{fd}, void *@var{baseaddr});
+Initialize access to a @code{mmalloc} managed region.
+
+If @var{fd} is a valid file descriptor for an open file, then data for the
+@code{mmalloc} managed region is mapped to that file.   Otherwise
+@file{/dev/zero} is used and the data will not exist in any filesystem object.
+
+If the open file corresponding to @var{fd} is from a previous use of
+@code{mmalloc} and passes some basic sanity checks to ensure that it is
+compatible with the current @code{mmalloc} package, then its data is
+mapped in and is immediately accessible at the same addresses in
+the current process as the process that created the file.
+
+If @var{baseaddr} is not @code{NULL}, the mapping is established
+starting at the specified address in the process address space.  If
+@var{baseaddr} is @code{NULL}, the @code{mmalloc} package chooses a
+suitable address at which to start the mapped region, which will be the
+value of the previous mapping if opening an existing file which was
+previously built by @code{mmalloc}, or for new files will be a value
+chosen by @code{mmap}.
+
+Specifying @var{baseaddr} provides more control over where the regions
+start and how big they can be before bumping into existing mapped
+regions or future mapped regions.
+
+On success, returns a malloc descriptor which is used in subsequent
+calls to other @code{mmalloc} package functions.  It is explicitly
+@samp{void *} (@samp{char *} for systems that don't fully support
+@code{void}) so that users of the package don't have to worry about the
+actual implementation details.
+
+On failure returns @code{NULL}.
+
+@item void *mmalloc_detach (void *@var{md});
+Terminate access to a @code{mmalloc} managed region identified by the
+descriptor @var{md}, by closing the base file and unmapping all memory
+pages associated with the region. 
+
+Returns @code{NULL} on success.
+
+Returns the malloc descriptor on failure, which can subsequently
+be used for further action (such as obtaining more information about
+the nature of the failure).
+
+@item void *mmalloc (void *@var{md}, size_t @var{size});
+Given an @code{mmalloc} descriptor @var{md}, allocate additional memory of
+@var{size} bytes in the associated mapped region.
+
+@item *mrealloc (void *@var{md}, void *@var{ptr}, size_t @var{size});
+Given an @code{mmalloc} descriptor @var{md} and a pointer to memory
+previously allocated by @code{mmalloc} in @var{ptr}, reallocate the
+memory to be @var{size} bytes long, possibly moving the existing
+contents of memory if necessary.
+	
+@item void *mvalloc (void *@var{md}, size_t @var{size});
+Like @code{mmalloc} but the resulting memory is aligned on a page boundary.
+
+@item void mfree (void *@var{md}, void *@var{ptr});
+Given an @code{mmalloc} descriptor @var{md} and a pointer to memory previously
+allocated by @code{mmalloc} in @var{ptr}, free the previously allocated memory.
+
+@item int mmalloc_errno (void *@var{md});
+Given a @code{mmalloc} descriptor, if the last @code{mmalloc} operation
+failed for some reason due to a system call failure, then
+returns the associated @code{errno}.  Returns 0 otherwise.
+(This function is not yet implemented).
+@end table
+
+@bye
diff --git a/mmalloc/mmap-sup.c b/mmalloc/mmap-sup.c
new file mode 100644
index 0000000..b12e43c
--- /dev/null
+++ b/mmalloc/mmap-sup.c
@@ -0,0 +1,220 @@
+/* Support for an sbrk-like function that uses mmap.
+   Copyright 1992, 2000 Free Software Foundation, Inc.
+
+   Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#if defined(HAVE_MMAP)
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>	/* Prototypes for lseek */
+#endif
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+#include "mmprivate.h"
+
+/* Cache the pagesize for the current host machine.  Note that if the host
+   does not readily provide a getpagesize() function, we need to emulate it
+   elsewhere, not clutter up this file with lots of kluges to try to figure
+   it out. */
+
+static size_t pagesize;
+#if NEED_DECLARATION_GETPAGESIZE
+extern int getpagesize PARAMS ((void));
+#endif
+
+#define PAGE_ALIGN(addr) (caddr_t) (((long)(addr) + pagesize - 1) & \
+				    ~(pagesize - 1))
+
+
+/* Return MAP_PRIVATE if MDP represents /dev/zero.  Otherwise, return
+   MAP_SHARED.  */
+
+#define MAP_PRIVATE_OR_SHARED(MDP) ((MDP -> flags & MMALLOC_DEVZERO) \
+                                    ? MAP_PRIVATE \
+                                    : MAP_SHARED)
+
+
+/*  Get core for the memory region specified by MDP, using SIZE as the
+    amount to either add to or subtract from the existing region.  Works
+    like sbrk(), but using mmap(). */
+
+PTR
+__mmalloc_mmap_morecore (mdp, size)
+  struct mdesc *mdp;
+  int size;
+{
+  PTR result = NULL;
+  off_t foffset;	/* File offset at which new mapping will start */
+  size_t mapbytes;	/* Number of bytes to map */
+  caddr_t moveto;	/* Address where we wish to move "break value" to */
+  caddr_t mapto;	/* Address we actually mapped to */
+  char buf = 0;		/* Single byte to write to extend mapped file */
+
+  if (pagesize == 0)
+    {
+      pagesize = getpagesize ();
+    }
+  if (size == 0)
+    {
+      /* Just return the current "break" value. */
+      result = mdp -> breakval;
+    }
+  else if (size < 0)
+    {
+      /* We are deallocating memory.  If the amount requested would cause
+	 us to try to deallocate back past the base of the mmap'd region
+	 then do nothing, and return NULL.  Otherwise, deallocate the
+	 memory and return the old break value. */
+      if (mdp -> breakval + size >= mdp -> base)
+	{
+	  result = (PTR) mdp -> breakval;
+	  mdp -> breakval += size;
+	  moveto = PAGE_ALIGN (mdp -> breakval);
+	  munmap (moveto, (size_t) (mdp -> top - moveto));
+	  mdp -> top = moveto;
+	}
+    }
+  else
+    {
+      /* We are allocating memory.  Make sure we have an open file
+	 descriptor and then go on to get the memory. */
+      if (mdp -> fd < 0)
+	{
+	  result = NULL;
+	}
+      else if (mdp -> breakval + size > mdp -> top)
+	{
+	  /* The request would move us past the end of the currently
+	     mapped memory, so map in enough more memory to satisfy
+	     the request.  This means we also have to grow the mapped-to
+	     file by an appropriate amount, since mmap cannot be used
+	     to extend a file. */
+	  moveto = PAGE_ALIGN (mdp -> breakval + size);
+	  mapbytes = moveto - mdp -> top;
+	  foffset = mdp -> top - mdp -> base;
+	  /* FIXME:  Test results of lseek() and write() */
+	  lseek (mdp -> fd, foffset + mapbytes - 1, SEEK_SET);
+	  write (mdp -> fd, &buf, 1);
+	  if (mdp -> base == 0)
+	    {
+	      /* Let mmap pick the map start address */
+	      mapto = mmap (0, mapbytes, PROT_READ | PROT_WRITE,
+			    MAP_PRIVATE_OR_SHARED (mdp), mdp -> fd, foffset);
+	      if (mapto != (caddr_t) -1)
+		{
+		  mdp -> base = mdp -> breakval = mapto;
+		  mdp -> top = mdp -> base + mapbytes;
+		  result = (PTR) mdp -> breakval;
+		  mdp -> breakval += size;
+		}
+	    }
+	  else
+	    {
+	      mapto = mmap (mdp -> top, mapbytes, PROT_READ | PROT_WRITE,
+			    MAP_PRIVATE_OR_SHARED (mdp) | MAP_FIXED, mdp -> fd,
+			    foffset);
+	      if (mapto == mdp -> top)
+		{
+		  mdp -> top = moveto;
+		  result = (PTR) mdp -> breakval;
+		  mdp -> breakval += size;
+		}
+	    }
+	}
+      else
+	{
+	  result = (PTR) mdp -> breakval;
+	  mdp -> breakval += size;
+	}
+    }
+  return (result);
+}
+
+PTR
+__mmalloc_remap_core (mdp)
+  struct mdesc *mdp;
+{
+  caddr_t base;
+
+  /* FIXME:  Quick hack, needs error checking and other attention. */
+
+  base = mmap (mdp -> base, mdp -> top - mdp -> base,
+	       PROT_READ | PROT_WRITE, MAP_PRIVATE_OR_SHARED (mdp) | MAP_FIXED,
+	       mdp -> fd, 0);
+  return ((PTR) base);
+}
+
+PTR
+mmalloc_findbase (size)
+  int size;
+{
+  int fd;
+  int flags;
+  caddr_t base = NULL;
+
+#ifdef MAP_ANONYMOUS
+  flags = MAP_PRIVATE | MAP_ANONYMOUS;
+  fd = -1;
+#else
+#ifdef MAP_FILE
+  flags = MAP_PRIVATE | MAP_FILE;
+#else
+  flags = MAP_PRIVATE;
+#endif
+  fd = open ("/dev/zero", O_RDWR);
+  if (fd != -1)
+    {
+      return ((PTR) NULL);
+    }
+#endif
+  base = mmap (0, size, PROT_READ | PROT_WRITE, flags, fd, 0);
+  if (base != (caddr_t) -1)
+    {
+      munmap (base, (size_t) size);
+    }
+  if (fd != -1)
+    {
+      close (fd);
+    }
+  if (base == 0)
+    {
+      /* Don't allow mapping at address zero.  We use that value
+	 to signal an error return, and besides, it is useful to
+	 catch NULL pointers if it is unmapped.  Instead start
+	 at the next page boundary. */
+      base = (caddr_t) getpagesize ();
+    }
+  else if (base == (caddr_t) -1)
+    {
+      base = NULL;
+    }
+  return ((PTR) base);
+}
+
+#else	/* defined(HAVE_MMAP) */
+/* Prevent "empty translation unit" warnings from the idiots at X3J11. */
+static char ansi_c_idiots = 69;
+#endif	/* defined(HAVE_MMAP) */
diff --git a/mmalloc/mmcheck.c b/mmalloc/mmcheck.c
new file mode 100644
index 0000000..48936b3
--- /dev/null
+++ b/mmalloc/mmcheck.c
@@ -0,0 +1,223 @@
+/* Standard debugging hooks for `mmalloc'.
+   Copyright 1990, 1991, 1992 Free Software Foundation
+
+   Written May 1989 by Mike Haertel.
+   Heavily modified Mar 1992 by Fred Fish (fnf@cygnus.com)
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+ The author may be reached (Email) at the address mike@ai.mit.edu,
+ or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+#include "mmprivate.h"
+
+/* Default function to call when something awful happens.  The application
+   can specify an alternate function to be called instead (and probably will
+   want to). */
+
+extern void abort PARAMS ((void));
+
+/* Arbitrary magical numbers.  */
+
+#define MAGICWORD	(unsigned int) 0xfedabeeb	/* Active chunk */
+#define MAGICWORDFREE	(unsigned int) 0xdeadbeef	/* Inactive chunk */
+#define MAGICBYTE	((char) 0xd7)
+
+/* Each memory allocation is bounded by a header structure and a trailer
+   byte.  I.E.
+
+	<size><magicword><user's allocation><magicbyte>
+
+   The pointer returned to the user points to the first byte in the
+   user's allocation area.  The magic word can be tested to detect
+   buffer underruns and the magic byte can be tested to detect overruns. */
+
+struct hdr
+  {
+    size_t size;		/* Exact size requested by user.  */
+    unsigned long int magic;	/* Magic number to check header integrity.  */
+  };
+
+static void checkhdr PARAMS ((struct mdesc *, CONST struct hdr *));
+static void mfree_check PARAMS ((PTR, PTR));
+static PTR mmalloc_check PARAMS ((PTR, size_t));
+static PTR mrealloc_check PARAMS ((PTR, PTR, size_t));
+
+/* Check the magicword and magicbyte, and if either is corrupted then
+   call the emergency abort function specified for the heap in use. */
+
+static void
+checkhdr (mdp, hdr)
+  struct mdesc *mdp;
+  CONST struct hdr *hdr;
+{
+  if (hdr -> magic != MAGICWORD ||
+      ((char *) &hdr[1])[hdr -> size] != MAGICBYTE)
+    {
+      (*mdp -> abortfunc)();
+    }
+}
+
+static void
+mfree_check (md, ptr)
+  PTR md;
+  PTR ptr;
+{
+  struct hdr *hdr = ((struct hdr *) ptr) - 1;
+  struct mdesc *mdp;
+
+  mdp = MD_TO_MDP (md);
+  checkhdr (mdp, hdr);
+  hdr -> magic = MAGICWORDFREE;
+  mdp -> mfree_hook = NULL;
+  mfree (md, (PTR)hdr);
+  mdp -> mfree_hook = mfree_check;
+}
+
+static PTR
+mmalloc_check (md, size)
+  PTR md;
+  size_t size;
+{
+  struct hdr *hdr;
+  struct mdesc *mdp;
+  size_t nbytes;
+
+  mdp = MD_TO_MDP (md);
+  mdp -> mmalloc_hook = NULL;
+  nbytes = sizeof (struct hdr) + size + 1;
+  hdr = (struct hdr *) mmalloc (md, nbytes);
+  mdp -> mmalloc_hook = mmalloc_check;
+  if (hdr != NULL)
+    {
+      hdr -> size = size;
+      hdr -> magic = MAGICWORD;
+      hdr++;
+      *((char *) hdr + size) = MAGICBYTE;
+    }
+  return ((PTR) hdr);
+}
+
+static PTR
+mrealloc_check (md, ptr, size)
+  PTR md;
+  PTR ptr;
+  size_t size;
+{
+  struct hdr *hdr = ((struct hdr *) ptr) - 1;
+  struct mdesc *mdp;
+  size_t nbytes;
+
+  mdp = MD_TO_MDP (md);
+  checkhdr (mdp, hdr);
+  mdp -> mfree_hook = NULL;
+  mdp -> mmalloc_hook = NULL;
+  mdp -> mrealloc_hook = NULL;
+  nbytes = sizeof (struct hdr) + size + 1;
+  hdr = (struct hdr *) mrealloc (md, (PTR) hdr, nbytes);
+  mdp -> mfree_hook = mfree_check;
+  mdp -> mmalloc_hook = mmalloc_check;
+  mdp -> mrealloc_hook = mrealloc_check;
+  if (hdr != NULL)
+    {
+      hdr -> size = size;
+      hdr++;
+      *((char *) hdr + size) = MAGICBYTE;
+    }
+  return ((PTR) hdr);
+}
+
+/* Turn on default checking for mmalloc/mrealloc/mfree, for the heap specified
+   by MD.  If FUNC is non-NULL, it is a pointer to the function to call
+   to abort whenever memory corruption is detected.  By default, this is the
+   standard library function abort().
+
+   Note that we disallow installation of initial checking hooks if mmalloc
+   has been called at any time for this particular heap, since if any region
+   that is allocated prior to installation of the hooks is subsequently
+   reallocated or freed after installation of the hooks, it is guaranteed
+   to trigger a memory corruption error.  We do this by checking the state
+   of the MMALLOC_INITIALIZED flag.  If the FORCE argument is non-zero, this
+   checking is disabled and it is allowed to install the checking hooks at any
+   time.  This is useful on systems where the C runtime makes one or more
+   malloc calls before the user code had a chance to call mmcheck or mmcheckf,
+   but never calls free with these values.  Thus if we are certain that only
+   values obtained from mallocs after an mmcheck/mmcheckf will ever be passed
+   to free(), we can go ahead and force installation of the useful checking
+   hooks.
+
+   However, we can call this function at any time after the initial call,
+   to update the function pointers to the checking routines and to the
+   user defined corruption handler routine, as long as these function pointers
+   have been previously extablished by the initial call.  Note that we
+   do this automatically when remapping a previously used heap, to ensure
+   that the hooks get updated to the correct values, although the corruption
+   handler pointer gets set back to the default.  The application can then
+   call mmcheck to use a different corruption handler if desired.
+
+   Returns non-zero if checking is successfully enabled, zero otherwise. */
+
+int
+mmcheckf (md, func, force)
+  PTR md;
+  void (*func) PARAMS ((void));
+  int force;
+{
+  struct mdesc *mdp;
+  int rtnval;
+
+  mdp = MD_TO_MDP (md);
+
+  /* We can safely set or update the abort function at any time, regardless
+     of whether or not we successfully do anything else. */
+
+  mdp -> abortfunc = (func != NULL ? func : abort);
+
+  /* If we haven't yet called mmalloc the first time for this heap, or if we
+     have hooks that were previously installed, then allow the hooks to be
+     initialized or updated. */
+
+  if (force ||
+      !(mdp -> flags & MMALLOC_INITIALIZED) ||
+      (mdp -> mfree_hook != NULL))
+    {
+      mdp -> mfree_hook = mfree_check;
+      mdp -> mmalloc_hook = mmalloc_check;
+      mdp -> mrealloc_hook = mrealloc_check;
+      mdp -> flags |= MMALLOC_MMCHECK_USED;
+      rtnval = 1;
+    }
+  else
+    {
+      rtnval = 0;
+    }
+
+  return (rtnval);
+}
+
+/* This routine is for backwards compatibility only, in case there are
+   still callers to the original mmcheck function. */
+
+int
+mmcheck (md, func)
+  PTR md;
+  void (*func) PARAMS ((void));
+{
+  int rtnval;
+
+  rtnval = mmcheckf (md, func, 0);
+  return (rtnval);
+}
diff --git a/mmalloc/mmemalign.c b/mmalloc/mmemalign.c
new file mode 100644
index 0000000..3ada027
--- /dev/null
+++ b/mmalloc/mmemalign.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include "mmprivate.h"
+
+PTR
+mmemalign (md, alignment, size)
+  PTR md;
+  size_t alignment;
+  size_t size;
+{
+  PTR result;
+  unsigned long int adj;
+  struct alignlist *l;
+  struct mdesc *mdp;
+
+  if ((result = mmalloc (md, size + alignment - 1)) != NULL)
+    {
+      adj = RESIDUAL (result, alignment);
+      if (adj != 0)
+	{
+	  mdp = MD_TO_MDP (md);
+	  for (l = mdp -> aligned_blocks; l != NULL; l = l -> next)
+	    {
+	      if (l -> aligned == NULL)
+		{
+		  /* This slot is free.  Use it.  */
+		  break;
+		}
+	    }
+	  if (l == NULL)
+	    {
+	      l = (struct alignlist *) mmalloc (md, sizeof (struct alignlist));
+	      if (l == NULL)
+		{
+		  mfree (md, result);
+		  return (NULL);
+		}
+	      l -> next = mdp -> aligned_blocks;
+	      mdp -> aligned_blocks = l;
+	    }
+	  l -> exact = result;
+	  result = l -> aligned = (char *) result + alignment - adj;
+	}
+    }
+  return (result);
+}
diff --git a/mmalloc/mmprivate.h b/mmalloc/mmprivate.h
new file mode 100644
index 0000000..4576262
--- /dev/null
+++ b/mmalloc/mmprivate.h
@@ -0,0 +1,343 @@
+/* Declarations for `mmalloc' and friends.
+   Copyright 1990, 1991, 1992 Free Software Foundation
+
+   Written May 1989 by Mike Haertel.
+   Heavily modified Mar 1992 by Fred Fish. (fnf@cygnus.com)
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+
+#ifndef __MMPRIVATE_H
+#define __MMPRIVATE_H 1
+
+#include "mmalloc.h"
+
+#ifdef HAVE_LIMITS_H
+#  include <limits.h>
+#else
+#  ifndef CHAR_BIT
+#    define CHAR_BIT 8
+#  endif
+#endif
+
+#ifndef MIN
+#  define MIN(A, B) ((A) < (B) ? (A) : (B))
+#endif
+
+#define MMALLOC_MAGIC		"mmalloc"	/* Mapped file magic number */
+#define MMALLOC_MAGIC_SIZE	8		/* Size of magic number buf */
+#define MMALLOC_VERSION		1		/* Current mmalloc version */
+#define MMALLOC_KEYS		16		/* Keys for application use */
+
+/* The allocator divides the heap into blocks of fixed size; large
+   requests receive one or more whole blocks, and small requests
+   receive a fragment of a block.  Fragment sizes are powers of two,
+   and all fragments of a block are the same size.  When all the
+   fragments in a block have been freed, the block itself is freed.  */
+
+#define INT_BIT		(CHAR_BIT * sizeof(int))
+#define BLOCKLOG	(INT_BIT > 16 ? 12 : 9)
+#define BLOCKSIZE	((unsigned int) 1 << BLOCKLOG)
+#define BLOCKIFY(SIZE)	(((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE)
+
+/* The difference between two pointers is a signed int.  On machines where
+   the data addresses have the high bit set, we need to ensure that the
+   difference becomes an unsigned int when we are using the address as an
+   integral value.  In addition, when using with the '%' operator, the
+   sign of the result is machine dependent for negative values, so force
+   it to be treated as an unsigned int. */
+
+#define ADDR2UINT(addr)	((unsigned int) ((char *) (addr) - (char *) NULL))
+#define RESIDUAL(addr,bsize) ((unsigned int) (ADDR2UINT (addr) % (bsize)))
+
+/* Determine the amount of memory spanned by the initial heap table
+   (not an absolute limit).  */
+
+#define HEAP		(INT_BIT > 16 ? 4194304 : 65536)
+
+/* Number of contiguous free blocks allowed to build up at the end of
+   memory before they will be returned to the system.  */
+
+#define FINAL_FREE_BLOCKS	8
+
+/* Where to start searching the free list when looking for new memory.
+   The two possible values are 0 and heapindex.  Starting at 0 seems
+   to reduce total memory usage, while starting at heapindex seems to
+   run faster.  */
+
+#define MALLOC_SEARCH_START	mdp -> heapindex
+
+/* Address to block number and vice versa.  */
+
+#define BLOCK(A) (((char *) (A) - mdp -> heapbase) / BLOCKSIZE + 1)
+
+#define ADDRESS(B) ((PTR) (((B) - 1) * BLOCKSIZE + mdp -> heapbase))
+
+/* Data structure giving per-block information.  */
+
+typedef union
+  {
+    /* Heap information for a busy block.  */
+    struct
+      {
+	/* Zero for a large block, or positive giving the
+	   logarithm to the base two of the fragment size.  */
+	int type;
+	union
+	  {
+	    struct
+	      {
+		size_t nfree;	/* Free fragments in a fragmented block.  */
+		size_t first;	/* First free fragment of the block.  */
+	      } frag;
+	    /* Size (in blocks) of a large cluster.  */
+	    size_t size;
+	  } info;
+      } busy;
+    /* Heap information for a free block (that may be the first of
+       a free cluster).  */
+    struct
+      {
+	size_t size;		/* Size (in blocks) of a free cluster.  */
+	size_t next;		/* Index of next free cluster.  */
+	size_t prev;		/* Index of previous free cluster.  */
+      } free;
+  } malloc_info;
+
+/* List of blocks allocated with `mmemalign' (or `mvalloc').  */
+
+struct alignlist
+  {
+    struct alignlist *next;
+    PTR aligned;		/* The address that mmemaligned returned.  */
+    PTR exact;			/* The address that malloc returned.  */
+  };
+
+/* Doubly linked lists of free fragments.  */
+
+struct list
+  {
+    struct list *next;
+    struct list *prev;
+  };
+
+/* Statistics available to the user.
+   FIXME:  By design, the internals of the malloc package are no longer
+   exported to the user via an include file, so access to this data needs
+   to be via some other mechanism, such as mmstat_<something> where the
+   return value is the <something> the user is interested in. */
+
+struct mstats
+  {
+    size_t bytes_total;		/* Total size of the heap. */
+    size_t chunks_used;		/* Chunks allocated by the user. */
+    size_t bytes_used;		/* Byte total of user-allocated chunks. */
+    size_t chunks_free;		/* Chunks in the free list. */
+    size_t bytes_free;		/* Byte total of chunks in the free list. */
+  };
+
+/* Internal structure that defines the format of the malloc-descriptor.
+   This gets written to the base address of the region that mmalloc is
+   managing, and thus also becomes the file header for the mapped file,
+   if such a file exists. */
+
+struct mdesc
+{
+  /* The "magic number" for an mmalloc file. */
+
+  char magic[MMALLOC_MAGIC_SIZE];
+
+  /* The size in bytes of this structure, used as a sanity check when reusing
+     a previously created mapped file. */
+
+  unsigned int headersize;
+
+  /* The version number of the mmalloc package that created this file. */
+
+  unsigned char version;
+
+  /* Some flag bits to keep track of various internal things. */
+
+  unsigned int flags;
+
+  /* If a system call made by the mmalloc package fails, the errno is
+     preserved for future examination. */
+
+  int saved_errno;
+
+  /* Pointer to the function that is used to get more core, or return core
+     to the system, for requests using this malloc descriptor.  For memory
+     mapped regions, this is the mmap() based routine.  There may also be
+     a single malloc descriptor that points to an sbrk() based routine
+     for systems without mmap() or for applications that call the mmalloc()
+     package with a NULL malloc descriptor.
+
+     FIXME:  For mapped regions shared by more than one process, this
+     needs to be maintained on a per-process basis. */
+
+  PTR (*morecore) PARAMS ((struct mdesc *, int));
+     
+  /* Pointer to the function that causes an abort when the memory checking
+     features are activated.  By default this is set to abort(), but can
+     be set to another function by the application using mmalloc().
+
+     FIXME:  For mapped regions shared by more than one process, this
+     needs to be maintained on a per-process basis. */
+
+  void (*abortfunc) PARAMS ((void));
+
+  /* Debugging hook for free.
+
+     FIXME:  For mapped regions shared by more than one process, this
+     needs to be maintained on a per-process basis. */
+
+  void (*mfree_hook) PARAMS ((PTR, PTR));
+
+  /* Debugging hook for `malloc'.
+
+     FIXME:  For mapped regions shared by more than one process, this
+     needs to be maintained on a per-process basis. */
+
+  PTR (*mmalloc_hook) PARAMS ((PTR, size_t));
+
+  /* Debugging hook for realloc.
+
+     FIXME:  For mapped regions shared by more than one process, this
+     needs to be maintained on a per-process basis. */
+
+  PTR (*mrealloc_hook) PARAMS ((PTR, PTR, size_t));
+
+  /* Number of info entries.  */
+
+  size_t heapsize;
+
+  /* Pointer to first block of the heap (base of the first block).  */
+
+  char *heapbase;
+
+  /* Current search index for the heap table.  */
+  /* Search index in the info table.  */
+
+  size_t heapindex;
+
+  /* Limit of valid info table indices.  */
+
+  size_t heaplimit;
+
+  /* Block information table.
+     Allocated with malign/__mmalloc_free (not mmalloc/mfree).  */
+  /* Table indexed by block number giving per-block information.  */
+
+  malloc_info *heapinfo;
+
+  /* Instrumentation.  */
+
+  struct mstats heapstats;
+
+  /* Free list headers for each fragment size.  */
+  /* Free lists for each fragment size.  */
+
+  struct list fraghead[BLOCKLOG];
+
+  /* List of blocks allocated by memalign.  */
+
+  struct alignlist *aligned_blocks;
+
+  /* The base address of the memory region for this malloc heap.  This
+     is the location where the bookkeeping data for mmap and for malloc
+     begins. */
+
+  char *base;
+
+  /* The current location in the memory region for this malloc heap which
+     represents the end of memory in use. */
+
+  char *breakval;
+
+  /* The end of the current memory region for this malloc heap.  This is
+     the first location past the end of mapped memory. */
+
+  char *top;
+
+  /* Open file descriptor for the file to which this malloc heap is mapped.
+     This will always be a valid file descriptor, since /dev/zero is used
+     by default if no open file is supplied by the client.  Also note that
+     it may change each time the region is mapped and unmapped. */
+
+  int fd;
+
+  /* An array of keys to data within the mapped region, for use by the
+     application.  */
+
+  PTR keys[MMALLOC_KEYS];
+
+};
+
+/* Bits to look at in the malloc descriptor flags word */
+
+#define MMALLOC_DEVZERO		(1 << 0)	/* Have mapped to /dev/zero */
+#define MMALLOC_INITIALIZED	(1 << 1)	/* Initialized mmalloc */
+#define MMALLOC_MMCHECK_USED	(1 << 2)	/* mmcheckf() called already */
+
+/* Internal version of `mfree' used in `morecore'. */
+
+extern void __mmalloc_free PARAMS ((struct mdesc *, PTR));
+
+/* Hooks for debugging versions.  */
+
+extern void (*__mfree_hook) PARAMS ((PTR, PTR));
+extern PTR (*__mmalloc_hook) PARAMS ((PTR, size_t));
+extern PTR (*__mrealloc_hook) PARAMS ((PTR, PTR, size_t));
+
+/* A default malloc descriptor for the single sbrk() managed region. */
+
+extern struct mdesc *__mmalloc_default_mdp;
+
+/* Initialize the first use of the default malloc descriptor, which uses
+   an sbrk() region. */
+
+extern struct mdesc *__mmalloc_sbrk_init PARAMS ((void));
+
+/* Grow or shrink a contiguous mapped region using mmap().
+   Works much like sbrk() */
+
+#if defined(HAVE_MMAP)
+
+extern PTR __mmalloc_mmap_morecore PARAMS ((struct mdesc *, int));
+
+#endif
+
+/* Remap a mmalloc region that was previously mapped. */
+
+extern PTR __mmalloc_remap_core PARAMS ((struct mdesc *));
+
+/* Macro to convert from a user supplied malloc descriptor to pointer to the
+   internal malloc descriptor.  If the user supplied descriptor is NULL, then
+   use the default internal version, initializing it if necessary.  Otherwise
+   just cast the user supplied version (which is void *) to the proper type
+   (struct mdesc *). */
+
+#define MD_TO_MDP(md) \
+  ((md) == NULL \
+   ? (__mmalloc_default_mdp == NULL \
+      ? __mmalloc_sbrk_init () \
+      : __mmalloc_default_mdp) \
+   : (struct mdesc *) (md))
+
+#endif  /* __MMPRIVATE_H */
diff --git a/mmalloc/mmstats.c b/mmalloc/mmstats.c
new file mode 100644
index 0000000..ed17323
--- /dev/null
+++ b/mmalloc/mmstats.c
@@ -0,0 +1,46 @@
+/* Access the statistics maintained by `mmalloc'.
+   Copyright 1990, 1991, 1992 Free Software Foundation
+
+   Written May 1989 by Mike Haertel.
+   Modified Mar 1992 by Fred Fish.  (fnf@cygnus.com)
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+#include "mmprivate.h"
+
+/* FIXME:  See the comment in mmprivate.h where struct mstats is defined.
+   None of the internal mmalloc structures should be externally visible
+   outside the library. */
+
+struct mstats
+mmstats (md)
+  PTR md;
+{
+  struct mstats result;
+  struct mdesc *mdp;
+
+  mdp = MD_TO_MDP (md);
+  result.bytes_total =
+      (char *) mdp -> morecore (mdp, 0) - mdp -> heapbase;
+  result.chunks_used = mdp -> heapstats.chunks_used;
+  result.bytes_used = mdp -> heapstats.bytes_used;
+  result.chunks_free = mdp -> heapstats.chunks_free;
+  result.bytes_free = mdp -> heapstats.bytes_free;
+  return (result);
+}
diff --git a/mmalloc/mmtrace.awk b/mmalloc/mmtrace.awk
new file mode 100644
index 0000000..d7689ce
--- /dev/null
+++ b/mmalloc/mmtrace.awk
@@ -0,0 +1,36 @@
+#
+#  Awk program to analyze mtrace.c output.
+#
+$1 == "+"	{ if (allocated[$2] != "")
+		    print "+", $2, "Alloc", NR, "duplicate:", allocated[$2];
+		  else
+		    allocated[$2] = $3;
+		}
+$1 == "-"	{ if (allocated[$2] != "") {
+		    allocated[$2] = "";
+		    if (allocated[$2] != "")
+			print "DELETE FAILED", $2, allocated[$2];
+		  } else
+		    print "-", $2, "Free", NR, "was never alloc'd";
+		}
+$1 == "<"	{ if (allocated[$2] != "")
+		    allocated[$2] = "";
+		  else
+		    print "-", $2, "Realloc", NR, "was never alloc'd";
+		}
+$1 == ">"	{ if (allocated[$2] != "")
+		    print "+", $2, "Realloc", NR, "duplicate:", allocated[$2];
+		  else
+		    allocated[$2] = $3;
+		}
+
+# Ignore "= Start"
+$1 == "="	{ }
+# Ignore failed realloc attempts for now
+$1 == "!"	{ }
+
+
+END		{ for (x in allocated) 
+		    if (allocated[x] != "")
+		      print "+", x, allocated[x];
+		}
diff --git a/mmalloc/mmtrace.c b/mmalloc/mmtrace.c
new file mode 100644
index 0000000..563c860
--- /dev/null
+++ b/mmalloc/mmtrace.c
@@ -0,0 +1,171 @@
+/* More debugging hooks for `mmalloc'.
+   Copyright 1991, 1992, 1994 Free Software Foundation
+
+   Written April 2, 1991 by John Gilmore of Cygnus Support
+   Based on mcheck.c by Mike Haertel.
+   Modified Mar 1992 by Fred Fish.  (fnf@cygnus.com)
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include <stdio.h>
+#include "mmprivate.h"
+
+static void tr_break PARAMS ((void));
+static void tr_freehook PARAMS ((PTR, PTR));
+static PTR tr_mallochook PARAMS ((PTR, size_t));
+static PTR tr_reallochook PARAMS ((PTR, PTR, size_t));
+
+#ifndef	__GNU_LIBRARY__
+extern char *getenv ();
+#endif
+
+static FILE *mallstream;
+
+#if 0	/* FIXME:  Disabled for now. */
+static char mallenv[] = "MALLOC_TRACE";
+static char mallbuf[BUFSIZ];	/* Buffer for the output.  */
+#endif
+
+/* Address to breakpoint on accesses to... */
+static PTR mallwatch;
+
+/* Old hook values.  */
+
+static void (*old_mfree_hook) PARAMS ((PTR, PTR));
+static PTR (*old_mmalloc_hook) PARAMS ((PTR, size_t));
+static PTR (*old_mrealloc_hook) PARAMS ((PTR, PTR, size_t));
+
+/* This function is called when the block being alloc'd, realloc'd, or
+   freed has an address matching the variable "mallwatch".  In a debugger,
+   set "mallwatch" to the address of interest, then put a breakpoint on
+   tr_break.  */
+
+static void
+tr_break ()
+{
+}
+
+static void
+tr_freehook (md, ptr)
+  PTR md;
+  PTR ptr;
+{
+  struct mdesc *mdp;
+
+  mdp = MD_TO_MDP (md);
+  /* Be sure to print it first.  */
+  fprintf (mallstream, "- %08lx\n", (unsigned long) ptr);
+  if (ptr == mallwatch)
+    tr_break ();
+  mdp -> mfree_hook = old_mfree_hook;
+  mfree (md, ptr);
+  mdp -> mfree_hook = tr_freehook;
+}
+
+static PTR
+tr_mallochook (md, size)
+  PTR md;
+  size_t size;
+{
+  PTR hdr;
+  struct mdesc *mdp;
+
+  mdp = MD_TO_MDP (md);
+  mdp -> mmalloc_hook = old_mmalloc_hook;
+  hdr = (PTR) mmalloc (md, size);
+  mdp -> mmalloc_hook = tr_mallochook;
+
+  /* We could be printing a NULL here; that's OK.  */
+  fprintf (mallstream, "+ %08lx %x\n", (unsigned long) hdr, size);
+
+  if (hdr == mallwatch)
+    tr_break ();
+
+  return (hdr);
+}
+
+static PTR
+tr_reallochook (md, ptr, size)
+  PTR md;
+  PTR ptr;
+  size_t size;
+{
+  PTR hdr;
+  struct mdesc *mdp;
+
+  mdp = MD_TO_MDP (md);
+
+  if (ptr == mallwatch)
+    tr_break ();
+
+  mdp -> mfree_hook = old_mfree_hook;
+  mdp -> mmalloc_hook = old_mmalloc_hook;
+  mdp -> mrealloc_hook = old_mrealloc_hook;
+  hdr = (PTR) mrealloc (md, ptr, size);
+  mdp -> mfree_hook = tr_freehook;
+  mdp -> mmalloc_hook = tr_mallochook;
+  mdp -> mrealloc_hook = tr_reallochook;
+  if (hdr == NULL)
+    /* Failed realloc.  */
+    fprintf (mallstream, "! %08lx %x\n", (unsigned long) ptr, size);
+  else
+    fprintf (mallstream, "< %08lx\n> %08lx %x\n", (unsigned long) ptr,
+	     (unsigned long) hdr, size);
+
+  if (hdr == mallwatch)
+    tr_break ();
+
+  return hdr;
+}
+
+/* We enable tracing if either the environment variable MALLOC_TRACE
+   is set, or if the variable mallwatch has been patched to an address
+   that the debugging user wants us to stop on.  When patching mallwatch,
+   don't forget to set a breakpoint on tr_break!  */
+
+int
+mmtrace ()
+{
+#if 0	/* FIXME!  This is disabled for now until we figure out how to
+	   maintain a stack of hooks per heap, since we might have other
+	   hooks (such as set by mmcheck/mmcheckf) active also. */
+  char *mallfile;
+
+  mallfile = getenv (mallenv);
+  if (mallfile  != NULL || mallwatch != NULL)
+    {
+      mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "w");
+      if (mallstream != NULL)
+	{
+	  /* Be sure it doesn't mmalloc its buffer!  */
+	  setbuf (mallstream, mallbuf);
+	  fprintf (mallstream, "= Start\n");
+	  old_mfree_hook = mdp -> mfree_hook;
+	  mdp -> mfree_hook = tr_freehook;
+	  old_mmalloc_hook = mdp -> mmalloc_hook;
+	  mdp -> mmalloc_hook = tr_mallochook;
+	  old_mrealloc_hook = mdp -> mrealloc_hook;
+	  mdp -> mrealloc_hook = tr_reallochook;
+	}
+    }
+
+#endif	/* 0 */
+
+  return (1);
+}
+
diff --git a/mmalloc/mrealloc.c b/mmalloc/mrealloc.c
new file mode 100644
index 0000000..e2004aa
--- /dev/null
+++ b/mmalloc/mrealloc.c
@@ -0,0 +1,163 @@
+/* Change the size of a block allocated by `mmalloc'.
+   Copyright 1990, 1991 Free Software Foundation
+		  Written May 1989 by Mike Haertel.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation. */
+
+#include <string.h>	/* Prototypes for memcpy, memmove, memset, etc */
+
+#include "mmprivate.h"
+
+/* Resize the given region to the new size, returning a pointer
+   to the (possibly moved) region.  This is optimized for speed;
+   some benchmarks seem to indicate that greater compactness is
+   achieved by unconditionally allocating and copying to a
+   new region.  This module has incestuous knowledge of the
+   internals of both mfree and mmalloc. */
+
+PTR
+mrealloc (md, ptr, size)
+  PTR md;
+  PTR ptr;
+  size_t size;
+{
+  struct mdesc *mdp;
+  PTR result;
+  int type;
+  size_t block, blocks, oldlimit;
+
+  if (size == 0)
+    {
+      mfree (md, ptr);
+      return (mmalloc (md, 0));
+    }
+  else if (ptr == NULL)
+    {
+      return (mmalloc (md, size));
+    }
+
+  mdp = MD_TO_MDP (md);
+
+  if (mdp -> mrealloc_hook != NULL)
+    {
+      return ((*mdp -> mrealloc_hook) (md, ptr, size));
+    }
+
+  block = BLOCK (ptr);
+
+  type = mdp -> heapinfo[block].busy.type;
+  switch (type)
+    {
+    case 0:
+      /* Maybe reallocate a large block to a small fragment.  */
+      if (size <= BLOCKSIZE / 2)
+	{
+	  result = mmalloc (md, size);
+	  if (result != NULL)
+	    {
+	      memcpy (result, ptr, size);
+	      mfree (md, ptr);
+	      return (result);
+	    }
+	}
+
+      /* The new size is a large allocation as well;
+	 see if we can hold it in place. */
+      blocks = BLOCKIFY (size);
+      if (blocks < mdp -> heapinfo[block].busy.info.size)
+	{
+	  /* The new size is smaller; return excess memory to the free list. */
+	  mdp -> heapinfo[block + blocks].busy.type = 0;
+	  mdp -> heapinfo[block + blocks].busy.info.size
+	    = mdp -> heapinfo[block].busy.info.size - blocks;
+	  mdp -> heapinfo[block].busy.info.size = blocks;
+	  mfree (md, ADDRESS (block + blocks));
+	  result = ptr;
+	}
+      else if (blocks == mdp -> heapinfo[block].busy.info.size)
+	{
+	  /* No size change necessary.  */
+	  result = ptr;
+	}
+      else
+	{
+	  /* Won't fit, so allocate a new region that will.
+	     Free the old region first in case there is sufficient
+	     adjacent free space to grow without moving. */
+	  blocks = mdp -> heapinfo[block].busy.info.size;
+	  /* Prevent free from actually returning memory to the system.  */
+	  oldlimit = mdp -> heaplimit;
+	  mdp -> heaplimit = 0;
+	  mfree (md, ptr);
+	  mdp -> heaplimit = oldlimit;
+	  result = mmalloc (md, size);
+	  if (result == NULL)
+	    {
+	      mmalloc (md, blocks * BLOCKSIZE);
+	      return (NULL);
+	    }
+	  if (ptr != result)
+	    {
+	      memmove (result, ptr, blocks * BLOCKSIZE);
+	    }
+	}
+      break;
+
+    default:
+      /* Old size is a fragment; type is logarithm
+	 to base two of the fragment size.  */
+      if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type))
+	{
+	  /* The new size is the same kind of fragment.  */
+	  result = ptr;
+	}
+      else
+	{
+	  /* The new size is different; allocate a new space,
+	     and copy the lesser of the new size and the old. */
+	  result = mmalloc (md, size);
+	  if (result == NULL)
+	    {
+	      return (NULL);
+	    }
+	  memcpy (result, ptr, MIN (size, (size_t) 1 << type));
+	  mfree (md, ptr);
+	}
+      break;
+    }
+
+  return (result);
+}
+
+/* When using this package, provide a version of malloc/realloc/free built
+   on top of it, so that if we use the default sbrk() region we will not
+   collide with another malloc package trying to do the same thing, if
+   the application contains any "hidden" calls to malloc/realloc/free (such
+   as inside a system library). */
+
+PTR
+realloc (ptr, size)
+  PTR ptr;
+  size_t size;
+{
+  PTR result;
+
+  result = mrealloc ((PTR) NULL, ptr, size);
+  return (result);
+}
diff --git a/mmalloc/mvalloc.c b/mmalloc/mvalloc.c
new file mode 100644
index 0000000..e44942f
--- /dev/null
+++ b/mmalloc/mvalloc.c
@@ -0,0 +1,50 @@
+/* Allocate memory on a page boundary.
+   Copyright (C) 1991 Free Software Foundation, Inc.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include "mmprivate.h"
+
+/* Cache the pagesize for the current host machine.  Note that if the host
+   does not readily provide a getpagesize() function, we need to emulate it
+   elsewhere, not clutter up this file with lots of kluges to try to figure
+   it out. */
+
+static size_t cache_pagesize;
+#if NEED_DECLARATION_GETPAGESIZE
+extern int getpagesize PARAMS ((void));
+#endif
+
+PTR
+mvalloc (md, size)
+  PTR md;
+  size_t size;
+{
+  if (cache_pagesize == 0)
+    {
+      cache_pagesize = getpagesize ();
+    }
+
+  return (mmemalign (md, cache_pagesize, size));
+}
+
+
+PTR
+valloc (size)
+  size_t size;
+{
+  return mvalloc ((PTR) NULL, size);
+}
diff --git a/mmalloc/sbrk-sup.c b/mmalloc/sbrk-sup.c
new file mode 100644
index 0000000..93c078b
--- /dev/null
+++ b/mmalloc/sbrk-sup.c
@@ -0,0 +1,102 @@
+/* Support for sbrk() regions.
+   Copyright 1992, 2000 Free Software Foundation, Inc.
+   Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>	/* Prototypes for sbrk (maybe) */
+#endif
+#include <string.h>	/* Prototypes for memcpy, memmove, memset, etc */
+
+#include "mmprivate.h"
+
+static PTR sbrk_morecore PARAMS ((struct mdesc *, int));
+#if NEED_DECLARATION_SBRK
+extern PTR sbrk PARAMS ((int));
+#endif
+
+/* The mmalloc() package can use a single implicit malloc descriptor
+   for mmalloc/mrealloc/mfree operations which do not supply an explicit
+   descriptor.  For these operations, sbrk() is used to obtain more core
+   from the system, or return core.  This allows mmalloc() to provide
+   backwards compatibility with the non-mmap'd version. */
+
+struct mdesc *__mmalloc_default_mdp;
+
+/* Use sbrk() to get more core. */
+
+static PTR
+sbrk_morecore (mdp, size)
+  struct mdesc *mdp;
+  int size;
+{
+  PTR result;
+
+  if ((result = sbrk (size)) == (PTR) -1)
+    {
+      result = NULL;
+    }
+  else
+    {
+      mdp -> breakval += size;
+      mdp -> top += size;
+    }
+  return (result);
+}
+
+/* Initialize the default malloc descriptor if this is the first time
+   a request has been made to use the default sbrk'd region.
+
+   Since no alignment guarantees are made about the initial value returned
+   by sbrk, test the initial value and (if necessary) sbrk enough additional
+   memory to start off with alignment to BLOCKSIZE.  We actually only need
+   it aligned to an alignment suitable for any object, so this is overkill.
+   But at most it wastes just part of one BLOCKSIZE chunk of memory and
+   minimizes portability problems by avoiding us having to figure out
+   what the actual minimal alignment is.  The rest of the malloc code
+   avoids this as well, by always aligning to the minimum of the requested
+   size rounded up to a power of two, or to BLOCKSIZE.
+
+   Note that we are going to use some memory starting at this initial sbrk
+   address for the sbrk region malloc descriptor, which is a struct, so the
+   base address must be suitably aligned. */
+
+struct mdesc *
+__mmalloc_sbrk_init ()
+{
+  PTR base;
+  unsigned int adj;
+
+  base = sbrk (0);
+  adj = RESIDUAL (base, BLOCKSIZE);
+  if (adj != 0)
+    {
+      sbrk (BLOCKSIZE - adj);
+      base = sbrk (0);
+    }
+  __mmalloc_default_mdp = (struct mdesc *) sbrk (sizeof (struct mdesc));
+  memset ((char *) __mmalloc_default_mdp, 0, sizeof (struct mdesc));
+  __mmalloc_default_mdp -> morecore = sbrk_morecore;
+  __mmalloc_default_mdp -> base = base;
+  __mmalloc_default_mdp -> breakval = __mmalloc_default_mdp -> top = sbrk (0);
+  __mmalloc_default_mdp -> fd = -1;
+  return (__mmalloc_default_mdp);
+}
+
+
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index bf289e9..f4eebbb 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,57 +1,3 @@
-2004-10-15  Alan Modra  <amodra@bigpond.net.au>
-
-	* Makefile.am: Run "make dep-am"
-	* Makefile.in: Regenerate.
-
-2004-10-12  Bob Wilson  <bob.wilson@acm.org>
-
-	* xtensa-dis.c: Use ISO C90 formatting.
-
-2004-10-09  Alan Modra  <amodra@bigpond.net.au>
-
-	* ppc-opc.c: Revert 2004-09-09 change.
-
-2004-10-07  Bob Wilson  <bob.wilson@acm.org>
-
-	* xtensa-dis.c (state_names): Delete.
-	(fetch_data): Use xtensa_isa_maxlength.
-	(print_xtensa_operand): Replace operand parameter with opcode/operand
-	pair.  Remove print_sr_name parameter.  Use new xtensa-isa.h functions.
-	(print_insn_xtensa): Use new xtensa-isa.h functions.  Handle multislot
-	instruction bundles.  Use xmalloc instead of malloc.
-
-2004-10-07  David Gibson  <david@gibson.dropbear.id.au>
-
-	* ppc-opc.c: Replace literal "0"s with NULLs in pointer
-	initializers.
-
-2004-10-07  Tomer Levi  <Tomer.Levi@nsc.com>
-
-	* crx-opc.c (crx_instruction): Support Co-processor insns.
-	* crx-dis.c (COP_ARG_TYPE): New enum for CO-Processor arguments.
-	(getregliststring): Change function to use the above enum.
-	(print_arg): Handle CO-Processor insns.
-	(crx_cinvs): Add 'b' option to invalidate the branch-target
-	cache.
-
-2004-10-06  Aldy Hernandez  <aldyh@redhat.com>
-
-	* ppc-opc.c (powerpc_opcodes): Add efscfd, efdabs, efdnabs,
-	efdneg, efdadd, efdsub, efdmul, efddiv, efdcmpgt, efdcmplt,
-	efdcmpeq, efdtstgt, efdtstlt, efdtsteq, efdcfsi, efdcfsid,
-	efdcfui, efdcfuid, efdcfsf, efdcfuf, efdctsi, efdctsidz, efdctsiz,
-	efdctui, efdctuidz, efdctuiz, efdctsf, efdctuf, efdctuf, efdcfs.
-
-2004-10-01  Bill Farmer  <Bill@the-farmers.freeserve.co.uk>
-
-	* pdp11-dis.c (print_insn_pdp11): Subtract the SOB's displacement
-	rather than add it.
-
-2004-09-30  Paul Brook  <paul@codesourcery.com>
-
-	* arm-dis.c (print_insn_arm): Handle 'e' for SMI instruction.
-	* arm-opc.h: Document %e.  Add ARMv6ZK instructions.
-
 2004-09-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* Makefile.am (AUTOMAKE_OPTIONS): Require 1.9.
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index b7d4cba..596dee2 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -845,8 +845,8 @@
   $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \
   $(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h
 xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \
-  $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h sysdep.h \
-  config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
+  $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/symcat.h
 z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h
 z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 19aee60..9bd778f 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -1375,8 +1375,8 @@
   $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \
   $(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h
 xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \
-  $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h sysdep.h \
-  config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
+  $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \
+  $(BFD_H) $(INCDIR)/symcat.h
 z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h
 z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 44cdeac..e918daf 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -1,5 +1,5 @@
 /* Instruction printing code for the ARM
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
    Modification by James G. Smith (jsmith@cygnus.co.uk)
@@ -900,15 +900,6 @@
 			}
 			break;
 
-		      case 'e':
-			{
-			  int imm;
-
-			  imm = (given & 0xf) | ((given & 0xfff00) >> 4);
-			  func (stream, "%d", imm);
-			}
-			break;
-
 		      default:
 			abort ();
 		      }
diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h
index 531f4587a..4b52f13 100644
--- a/opcodes/arm-opc.h
+++ b/opcodes/arm-opc.h
@@ -1,6 +1,6 @@
 /* Opcode table for the ARM.
 
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003
    Free Software Foundation, Inc.
    
    This program is free software; you can redistribute it and/or modify
@@ -18,19 +18,18 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
-struct arm_opcode
-{
-  unsigned long value, mask;	/* Recognise instruction if (op&mask)==value.  */
-  char *assembler;		/* How to disassemble this instruction.  */
+struct arm_opcode {
+    unsigned long value, mask;	/* recognise instruction if (op&mask)==value */
+    char *assembler;		/* how to disassemble this instruction */
 };
 
 struct thumb_opcode
 {
-  unsigned short value, mask;	/* Recognise instruction if (op&mask)==value.  */
-  char * assembler;		/* How to disassemble this instruction.  */
+    unsigned short value, mask;	/* recognise instruction if (op&mask)==value */
+    char * assembler;		/* how to disassemble this instruction */
 };
 
-/* Format of the assembler string :
+/* format of the assembler string :
    
    %%			%
    %<bitfield>d		print the bitfield in decimal
@@ -83,10 +82,10 @@
    %<bitfield>W         print (bitfield * 4) as a decimal
    %<bitfield>H         print (bitfield * 2) as a decimal
    %<bitfield>a         print (bitfield * 4) as a pc-rel offset + decoded symbol
-   %e                   print arm SMI operand (bits 0..7,8..19).  */
+*/
 
 /* Note: There is a partial ordering in this table - it must be searched from
-   the top to obtain a correct match.  */
+   the top to obtain a correct match. */
 
 static const struct arm_opcode arm_opcodes[] =
 {
@@ -99,26 +98,7 @@
     {0x00800090, 0x0fa000f0, "%22?sumull%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"},
     {0x00a00090, 0x0fa000f0, "%22?sumlal%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"},
 
-    /* ARM V6Z instructions.  */
-    {0x01600070, 0x0ff000f0, "smi%c\t%e"},
-    
-    /* ARM V6K instructions.  */
-    {0xf57ff01f, 0xffffffff, "clrex"},
-    {0x01d00f9f, 0x0ff00fff, "ldrexb%c\t%12-15r, [%16-19r]"},
-    {0x01b00f9f, 0x0ff00fff, "ldrexd%c\t%12-15r, [%16-19r]"},
-    {0x01f00f9f, 0x0ff00fff, "ldrexh%c\t%12-15r, [%16-19r]"},
-    {0x01c00f90, 0x0ff00ff0, "strexb%c\t%12-15r, %0-3r, [%16-19r]"},
-    {0x01a00f90, 0x0ff00ff0, "strexd%c\t%12-15r, %0-3r, [%16-19r]"},
-    {0x01e00f90, 0x0ff00ff0, "strexh%c\t%12-15r, %0-3r, [%16-19r]"},
-
-    /* ARM V6K NOP hints.  */
-    {0x0320f001, 0x0fffffff, "yield"},
-    {0x0320f002, 0x0fffffff, "wfe"},
-    {0x0320f003, 0x0fffffff, "wfi"},
-    {0x0320f004, 0x0fffffff, "sev"},
-    {0x0320f000, 0x0fffff00, "nop%c\t{%0-7d}"},
-
-    /* ARM V6 instructions.  */
+    /* ARM V6 instructions. */
     {0xfc500000, 0xfff00000, "mrrc2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
     {0xfc400000, 0xfff00000, "mcrr2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
     {0xf1080000, 0xfffdfe3f, "cpsie\t%8'a%7'i%6'f"},
diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c
index b2cf312..5796a2e 100644
--- a/opcodes/crx-dis.c
+++ b/opcodes/crx-dis.c
@@ -59,25 +59,10 @@
 /* CRX 'cinv' options.  */
 const cinv_entry crx_cinvs[] =
 {
-  {"[i]", 2}, {"[i,u]", 3}, {"[d]", 4}, {"[d,u]", 5}, 
-  {"[d,i]", 6}, {"[d,i,u]", 7}, {"[b]", 8}, 
-  {"[b,i]", 10}, {"[b,i,u]", 11}, {"[b,d]", 12}, 
-  {"[b,d,u]", 13}, {"[b,d,i]", 14}, {"[b,d,i,u]", 15}
+  {"[i]", 2}, {"[i,u]", 3}, {"[d]", 4},
+  {"[d,u]", 5}, {"[d,i]", 6}, {"[d,i,u]", 7}
 };
 
-/* Enum to distinguish CO-Processor [special] registers arguments 
-   from general purpose regidters.  */
-typedef enum COP_ARG_TYPE
-  {
-    /* Not a CO-Processor argument (probably a general purpose reg.).  */
-    NO_COP_ARG = 0,
-    /* A CO-Processor argument (c<N>).  */
-    COP_ARG,
-    /* A CO-Processor special argument (cs<N>).  */
-    COPS_ARG 
-  }
-COP_ARG_TYPE;
-
 /* Number of valid 'cinv' instruction options.  */
 int NUMCINVS = ((sizeof crx_cinvs)/(sizeof crx_cinvs[0]));
 /* Current opcode table entry we're disassembling.  */
@@ -104,7 +89,7 @@
 static char * getprocregname  (int);
 static char *gettrapstring    (unsigned);
 static char *getcinvstring    (unsigned);
-static void getregliststring  (int, char *, enum COP_ARG_TYPE);
+static void getregliststring  (int, char *, int);
 static wordU get_word_at_PC   (bfd_vma, struct disassemble_info *);
 static void get_words_at_PC   (bfd_vma, struct disassemble_info *);
 static unsigned long build_mask (void);
@@ -240,7 +225,7 @@
 /* Transform a register bit mask to a register list.  */
 
 void
-getregliststring (int trap, char *string, enum COP_ARG_TYPE core_cop)
+getregliststring (int trap, char *string, int core_cop)
 {
   char temp_string[5];
   int i;
@@ -251,21 +236,11 @@
   for (i = 0; i < 16; i++)
     {
       if (trap & 0x1)
-	{
-	  switch (core_cop)
-	    {
-	    case NO_COP_ARG:
-	      sprintf (temp_string, "r%d", i);
-	      break;
-	    case COP_ARG:
-	      sprintf (temp_string, "c%d", i);
-	      break;
-	    case COPS_ARG:
-	      sprintf (temp_string, "cs%d", i);
-	      break;
-	    default:
-	      break;
-	    }
+        {
+          if (core_cop)
+	    sprintf (temp_string, "r%d", i);
+          else
+	    sprintf (temp_string, "c%d", i);
           strcat (string, temp_string);
           if (trap & 0xfffe)
 	    strcat (string, ",");
@@ -515,26 +490,22 @@
 
       else if (INST_HAS_REG_LIST)
         {
-	  COP_ARG_TYPE cop_ins = IS_INSN_TYPE (COP_REG_INS) ? 
-				 COP_ARG : IS_INSN_TYPE (COPS_REG_INS) ? 
-				 COPS_ARG : NO_COP_ARG;
-
-          if (cop_ins != NO_COP_ARG)
-	    {
-	      /*  Check for proper argument number.  */
-	      if (processing_argument_number == 2)
-		{
-		  getregliststring (a->constant, string, cop_ins);
-		  func (stream, "%s", string);
-		}
-	      else
-		func (stream, "$0x%x", a->constant);
-	    }
-	  else
+          if (!IS_INSN_TYPE (COP_REG_INS))
             {
-              getregliststring (a->constant, string, cop_ins);
+              getregliststring (a->constant, string, 1);
               func (stream, "%s", string);
             }
+          else
+            {
+              /*  Check for proper argument number.  */
+              if (processing_argument_number == 2)
+                {
+                  getregliststring (a->constant, string, 0);
+                  func (stream, "%s", string);
+                }
+              else
+		func (stream, "$0x%x", a->constant);
+            }
         }
       else
 	func (stream, "$0x%x", a->constant);
diff --git a/opcodes/crx-opc.c b/opcodes/crx-opc.c
index 846b78c..b01addf 100644
--- a/opcodes/crx-opc.c
+++ b/opcodes/crx-opc.c
@@ -488,55 +488,39 @@
 
   BR_INST ("bal",   0x307, 0x317, 0),
 
-  /* Decrement and Branch instructions.  */
+  /* Decrement and Branch instructions */
   BR_INST ("dbnzb", 0x304, 0x314, DCR_BRANCH_INS),
   BR_INST ("dbnzw", 0x305, 0x315, DCR_BRANCH_INS),
   BR_INST ("dbnzd", 0x306, 0x316, DCR_BRANCH_INS),
 
-  /* Jump and link instructions.  */
+  /* Jump and link instructions */
   REG1_INST ("jal",    0xFF8),
   REG2_INST ("jal",    0x37),
   REG2_INST ("jalid",  0x33),
 
-/* Create a CO-processor instruction.  */
-#define  COP_INST(NAME, OPC, TYPE, REG1, REG2) \
-  /* opc12 c4 opc8 REG1 REG2 */		       \
-  {NAME,  2, 0x301030+OPC,  8, TYPE | FMT_2, {{i4,16}, {REG1,4}, {REG2,0}}}
+  /* opc12 c4 opc12 r mask16 */
+  {"loadmcr", 3, 0x3110300, 4,	COP_REG_INS | REG_LIST | FMT_5, {{i4,16}, {regr,0}, {i16,0}}},
+  {"stormcr", 3, 0x3110301, 4,	COP_REG_INS | REG_LIST | FMT_5, {{i4,16}, {regr,0}, {i16,0}}},
 
-  COP_INST ("mtcr",   0, COP_REG_INS,	regr,	  copregr),
-  COP_INST ("mfcr",   1, COP_REG_INS,	copregr,  regr),
-  COP_INST ("mtcsr",  2, COPS_REG_INS,	regr,	  copsregr),
-  COP_INST ("mfcsr",  3, COPS_REG_INS,	copsregr, regr),
-  COP_INST ("ldcr",   4, COP_REG_INS,	regr,	  copregr),
-  COP_INST ("stcr",   5, COP_REG_INS,	regr,	  copregr),
-  COP_INST ("ldcsr",  6, COPS_REG_INS,	regr,	  copsregr),
-  COP_INST ("stcsr",  7, COPS_REG_INS,	regr,	  copsregr),
-
-/* Create a memory-related CO-processor instruction.  */
-#define  COPMEM_INST(NAME, OPC, TYPE) \
-  /* opc12 c4 opc12 r mask16 */	      \
-  {NAME,  3, 0x3110300+OPC,  4, TYPE | REG_LIST | FMT_5, {{i4,16}, {regr,0}, {i16,0}}}
-
-  COPMEM_INST("loadmcr",  0,  COP_REG_INS),
-  COPMEM_INST("stormcr",  1,  COP_REG_INS),
-  COPMEM_INST("loadmcsr", 2,  COPS_REG_INS),
-  COPMEM_INST("stormcsr", 3,  COPS_REG_INS),
-
-  /* CO-processor extensions.  */
-  /* opc12 c4 opc4 i4 disps9 */
-  {"bcop",    2, 0x30107, 12, COP_BRANCH_INS | FMT_4, {{i4,16}, {i4,8}, {d9,0}}},
-  /* opc12 c4 opc4 i4 disps25 */
-  {"bcop",    3, 0x31107, 12, COP_BRANCH_INS | FMT_4, {{i4,16}, {i4,8}, {d25,0}}},
-  /* opc12 c4 opc4 cpdo r r */
-  {"cpdop",   2, 0x3010B, 12, COP_REG_INS | FMT_4, {{i4,16}, {i4,8}, {regr,4}, {regr,0}}},
-  /* opc12 c4 opc4 cpdo r r cpdo16 */
-  {"cpdop",   3, 0x3110B, 12, COP_REG_INS | FMT_4, {{i4,16}, {i4,8}, {regr,4}, {regr,0}, {i16,0}}},
   /* esc16 r procreg */
   {"mtpr",    2, 0x3009,  16, 0, {{regr8,8}, {regr8,0}}},
   /* esc16 procreg r */
   {"mfpr",    2, 0x300A,  16, 0, {{regr8,8}, {regr8,0}}},
+  /* opc12 c4 opc8 r copreg */
+  {"mtcr",    2, 0x301030,  8, COP_REG_INS | FMT_2, {{i4,16}, {regr,4}, {copregr,0}}},
+  /* opc12 c4 opc8 copreg r */
+  {"mfcr",    2, 0x301031,  8, COP_REG_INS | FMT_2, {{i4,16}, {copregr,4}, {regr,0}}},
+  /* opc12 c4 opc8 r copsreg */
+  {"mtcsr",   2, 0x301032,  8, COP_REG_INS | FMT_2, {{i4,16}, {regr,4}, {copsregr,0}}},
+  /* opc12 c4 opc8 copsreg r */
+  {"mfcsr",   2, 0x301033,  8, COP_REG_INS | FMT_2, {{i4,16}, {copsregr,4}, {regr,0}}},
 
-  /* Miscellaneous.  */
+  /* CO-processor extensions */
+  /* opc12 c4 opc4 i4 disps9 */
+  {"bcop",    2, 0x30107, 12, COP_BRANCH_INS | FMT_4, {{i4,16}, {i4,8}, {d9,0}}},
+  /* opc12 c4 opc4 i4 disps25 */
+  {"bcop",    3, 0x31107, 12, COP_BRANCH_INS | FMT_4, {{i4,16}, {i4,8}, {d25,0}}},
+
   /* opc12 i4 */
   {"excp",    1, 0xFFF,	20, 0, {{i4,16}}},
   /* opc28 i4 */
diff --git a/opcodes/pdp11-dis.c b/opcodes/pdp11-dis.c
index 1756e53..4f5bf84 100644
--- a/opcodes/pdp11-dis.c
+++ b/opcodes/pdp11-dis.c
@@ -342,8 +342,7 @@
 	  case PDP11_OPCODE_REG_DISPL:
 	    {
 	      int displ = (opcode & 0x3f) << 10;
-	      bfd_vma address = memaddr - (displ >> 9);
-
+	      bfd_vma address = memaddr + (sign_extend (displ) >> 9);
 	      FPRINTF (F, OP.name);
 	      FPRINTF (F, AFTER_INSTRUCTION);
 	      print_reg (src, info);
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index c7351e8..af70ae6 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -109,12 +109,12 @@
   /* The zero index is used to indicate the end of the list of
      operands.  */
 #define UNUSED 0
-  { 0, 0, NULL, NULL, 0 },
+  { 0, 0, 0, 0, 0 },
 
   /* The BA field in an XL form instruction.  */
 #define BA UNUSED + 1
 #define BA_MASK (0x1f << 16)
-  { 5, 16, NULL, NULL, PPC_OPERAND_CR },
+  { 5, 16, 0, 0, PPC_OPERAND_CR },
 
   /* The BA field in an XL form instruction when it must be the same
      as the BT field in the same instruction.  */
@@ -124,7 +124,7 @@
   /* The BB field in an XL form instruction.  */
 #define BB BAT + 1
 #define BB_MASK (0x1f << 11)
-  { 5, 11, NULL, NULL, PPC_OPERAND_CR },
+  { 5, 11, 0, 0, PPC_OPERAND_CR },
 
   /* The BB field in an XL form instruction when it must be the same
      as the BA field in the same instruction.  */
@@ -167,21 +167,21 @@
 
   /* The BF field in an X or XL form instruction.  */
 #define BF BDPA + 1
-  { 3, 23, NULL, NULL, PPC_OPERAND_CR },
+  { 3, 23, 0, 0, PPC_OPERAND_CR },
 
   /* An optional BF field.  This is used for comparison instructions,
      in which an omitted BF field is taken as zero.  */
 #define OBF BF + 1
-  { 3, 23, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
+  { 3, 23, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
 
   /* The BFA field in an X or XL form instruction.  */
 #define BFA OBF + 1
-  { 3, 18, NULL, NULL, PPC_OPERAND_CR },
+  { 3, 18, 0, 0, PPC_OPERAND_CR },
 
   /* The BI field in a B form or XL form instruction.  */
 #define BI BFA + 1
 #define BI_MASK (0x1f << 16)
-  { 5, 16, NULL, NULL, PPC_OPERAND_CR },
+  { 5, 16, 0, 0, PPC_OPERAND_CR },
 
   /* The BO field in a B form instruction.  Certain values are
      illegal.  */
@@ -195,40 +195,40 @@
   { 5, 21, insert_boe, extract_boe, 0 },
 
 #define BH BOE + 1
-  { 2, 11, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 2, 11, 0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The BT field in an X or XL form instruction.  */
 #define BT BH + 1
-  { 5, 21, NULL, NULL, PPC_OPERAND_CR },
+  { 5, 21, 0, 0, PPC_OPERAND_CR },
 
   /* The condition register number portion of the BI field in a B form
      or XL form instruction.  This is used for the extended
      conditional branch mnemonics, which set the lower two bits of the
      BI field.  This field is optional.  */
 #define CR BT + 1
-  { 3, 18, NULL, NULL, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
+  { 3, 18, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
 
   /* The CRB field in an X form instruction.  */
 #define CRB CR + 1
-  { 5, 6, NULL, NULL, 0 },
+  { 5, 6, 0, 0, 0 },
 
   /* The CRFD field in an X form instruction.  */
 #define CRFD CRB + 1
-  { 3, 23, NULL, NULL, PPC_OPERAND_CR },
+  { 3, 23, 0, 0, PPC_OPERAND_CR },
 
   /* The CRFS field in an X form instruction.  */
 #define CRFS CRFD + 1
-  { 3, 0, NULL, NULL, PPC_OPERAND_CR },
+  { 3, 0, 0, 0, PPC_OPERAND_CR },
 
   /* The CT field in an X form instruction.  */
 #define CT CRFS + 1
-  { 5, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 5, 21, 0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The D field in a D form instruction.  This is a displacement off
      a register, and implies that the next operand is a register in
      parentheses.  */
 #define D CT + 1
-  { 16, 0, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
+  { 16, 0, 0, 0, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
 
   /* The DE field in a DE form instruction.  This is like D, but is 12
      bits only.  */
@@ -254,40 +254,40 @@
 
   /* The E field in a wrteei instruction.  */
 #define E DS + 1
-  { 1, 15, NULL, NULL, 0 },
+  { 1, 15, 0, 0, 0 },
 
   /* The FL1 field in a POWER SC form instruction.  */
 #define FL1 E + 1
-  { 4, 12, NULL, NULL, 0 },
+  { 4, 12, 0, 0, 0 },
 
   /* The FL2 field in a POWER SC form instruction.  */
 #define FL2 FL1 + 1
-  { 3, 2, NULL, NULL, 0 },
+  { 3, 2, 0, 0, 0 },
 
   /* The FLM field in an XFL form instruction.  */
 #define FLM FL2 + 1
-  { 8, 17, NULL, NULL, 0 },
+  { 8, 17, 0, 0, 0 },
 
   /* The FRA field in an X or A form instruction.  */
 #define FRA FLM + 1
 #define FRA_MASK (0x1f << 16)
-  { 5, 16, NULL, NULL, PPC_OPERAND_FPR },
+  { 5, 16, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRB field in an X or A form instruction.  */
 #define FRB FRA + 1
 #define FRB_MASK (0x1f << 11)
-  { 5, 11, NULL, NULL, PPC_OPERAND_FPR },
+  { 5, 11, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRC field in an A form instruction.  */
 #define FRC FRB + 1
 #define FRC_MASK (0x1f << 6)
-  { 5, 6, NULL, NULL, PPC_OPERAND_FPR },
+  { 5, 6, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRS field in an X form instruction or the FRT field in a D, X
      or A form instruction.  */
 #define FRS FRC + 1
 #define FRT FRS
-  { 5, 21, NULL, NULL, PPC_OPERAND_FPR },
+  { 5, 21, 0, 0, PPC_OPERAND_FPR },
 
   /* The FXM field in an XFX instruction.  */
 #define FXM FRS + 1
@@ -300,11 +300,11 @@
 
   /* The L field in a D or X form instruction.  */
 #define L FXM4 + 1
-  { 1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 1, 21, 0, 0, 0 },
 
   /* The LEV field in a POWER SC form instruction.  */
 #define LEV L + 1
-  { 7, 5, NULL, NULL, 0 },
+  { 7, 5, 0, 0, 0 },
 
   /* The LI field in an I form instruction.  The lower two bits are
      forced to zero.  */
@@ -318,24 +318,24 @@
 
   /* The LS field in an X (sync) form instruction.  */
 #define LS LIA + 1
-  { 2, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 2, 21, 0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The MB field in an M form instruction.  */
 #define MB LS + 1
 #define MB_MASK (0x1f << 6)
-  { 5, 6, NULL, NULL, 0 },
+  { 5, 6, 0, 0, 0 },
 
   /* The ME field in an M form instruction.  */
 #define ME MB + 1
 #define ME_MASK (0x1f << 1)
-  { 5, 1, NULL, NULL, 0 },
+  { 5, 1, 0, 0, 0 },
 
   /* The MB and ME fields in an M form instruction expressed a single
      operand which is a bitmask indicating which bits to select.  This
      is a two operand form using PPC_OPERAND_NEXT.  See the
      description in opcode/ppc.h for what this means.  */
 #define MBE ME + 1
-  { 5, 6, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
+  { 5, 6, 0, 0, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
   { 32, 0, insert_mbe, extract_mbe, 0 },
 
   /* The MB or ME field in an MD or MDS form instruction.  The high
@@ -347,7 +347,7 @@
 
   /* The MO field in an mbar instruction.  */
 #define MO MB6 + 1
-  { 5, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 5, 21, 0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The NB field in an X form instruction.  The value 32 is stored as
      0.  */
@@ -363,42 +363,42 @@
   /* The RA field in an D, DS, DQ, X, XO, M, or MDS form instruction.  */
 #define RA NSI + 1
 #define RA_MASK (0x1f << 16)
-  { 5, 16, NULL, NULL, PPC_OPERAND_GPR },
+  { 5, 16, 0, 0, PPC_OPERAND_GPR },
 
   /* As above, but 0 in the RA field means zero, not r0.  */
 #define RA0 RA + 1
-  { 5, 16, NULL, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 16, 0, 0, PPC_OPERAND_GPR_0 },
 
   /* The RA field in the DQ form lq instruction, which has special
      value restrictions.  */
 #define RAQ RA0 + 1
-  { 5, 16, insert_raq, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 16, insert_raq, 0, PPC_OPERAND_GPR_0 },
 
   /* The RA field in a D or X form instruction which is an updating
      load, which means that the RA field may not be zero and may not
      equal the RT field.  */
 #define RAL RAQ + 1
-  { 5, 16, insert_ral, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 16, insert_ral, 0, PPC_OPERAND_GPR_0 },
 
   /* The RA field in an lmw instruction, which has special value
      restrictions.  */
 #define RAM RAL + 1
-  { 5, 16, insert_ram, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 16, insert_ram, 0, PPC_OPERAND_GPR_0 },
 
   /* The RA field in a D or X form instruction which is an updating
      store or an updating floating point load, which means that the RA
      field may not be zero.  */
 #define RAS RAM + 1
-  { 5, 16, insert_ras, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 16, insert_ras, 0, PPC_OPERAND_GPR_0 },
 
   /* The RA field of the tlbwe instruction, which is optional.  */
 #define RAOPT RAS + 1
-  { 5, 16, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL },
+  { 5, 16, 0, 0, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL },
 
   /* The RB field in an X, XO, M, or MDS form instruction.  */
 #define RB RAOPT + 1
 #define RB_MASK (0x1f << 11)
-  { 5, 11, NULL, NULL, PPC_OPERAND_GPR },
+  { 5, 11, 0, 0, PPC_OPERAND_GPR },
 
   /* The RB field in an X form instruction when it must be the same as
      the RS field in the instruction.  This is used for extended
@@ -412,26 +412,26 @@
 #define RS RBS + 1
 #define RT RS
 #define RT_MASK (0x1f << 21)
-  { 5, 21, NULL, NULL, PPC_OPERAND_GPR },
+  { 5, 21, 0, 0, PPC_OPERAND_GPR },
 
   /* The RS field of the DS form stq instruction, which has special
      value restrictions.  */
 #define RSQ RS + 1
-  { 5, 21, insert_rsq, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 21, insert_rsq, 0, PPC_OPERAND_GPR_0 },
 
   /* The RT field of the DQ form lq instruction, which has special
      value restrictions.  */
 #define RTQ RSQ + 1
-  { 5, 21, insert_rtq, NULL, PPC_OPERAND_GPR_0 },
+  { 5, 21, insert_rtq, 0, PPC_OPERAND_GPR_0 },
 
   /* The RS field of the tlbwe instruction, which is optional.  */
 #define RSO RTQ + 1
-  { 5, 21, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL },
+  { 5, 21, 0, 0, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL },
 
   /* The SH field in an X or M form instruction.  */
 #define SH RSO + 1
 #define SH_MASK (0x1f << 11)
-  { 5, 11, NULL, NULL, 0 },
+  { 5, 11, 0, 0, 0 },
 
   /* The SH field in an MD form instruction.  This is split.  */
 #define SH6 SH + 1
@@ -440,16 +440,16 @@
 
   /* The SH field of the tlbwe instruction, which is optional.  */
 #define SHO SH6 + 1
-  { 5, 11,NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 5, 11,0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The SI field in a D form instruction.  */
 #define SI SHO + 1
-  { 16, 0, NULL, NULL, PPC_OPERAND_SIGNED },
+  { 16, 0, 0, 0, PPC_OPERAND_SIGNED },
 
   /* The SI field in a D form instruction when we accept a wide range
      of positive values.  */
 #define SISIGNOPT SI + 1
-  { 16, 0, NULL, NULL, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
+  { 16, 0, 0, 0, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
 
   /* The SPR field in an XFX form instruction.  This is flipped--the
      lower 5 bits are stored in the upper 5 and vice- versa.  */
@@ -461,25 +461,25 @@
   /* The BAT index number in an XFX form m[ft]ibat[lu] instruction.  */
 #define SPRBAT SPR + 1
 #define SPRBAT_MASK (0x3 << 17)
-  { 2, 17, NULL, NULL, 0 },
+  { 2, 17, 0, 0, 0 },
 
   /* The SPRG register number in an XFX form m[ft]sprg instruction.  */
 #define SPRG SPRBAT + 1
 #define SPRG_MASK (0x3 << 16)
-  { 2, 16, NULL, NULL, 0 },
+  { 2, 16, 0, 0, 0 },
 
   /* The SR field in an X form instruction.  */
 #define SR SPRG + 1
-  { 4, 16, NULL, NULL, 0 },
+  { 4, 16, 0, 0, 0 },
 
   /* The STRM field in an X AltiVec form instruction.  */
 #define STRM SR + 1
 #define STRM_MASK (0x3 << 21)
-  { 2, 21, NULL, NULL, 0 },
+  { 2, 21, 0, 0, 0 },
 
   /* The SV field in a POWER SC form instruction.  */
 #define SV STRM + 1
-  { 14, 2, NULL, NULL, 0 },
+  { 14, 2, 0, 0, 0 },
 
   /* The TBR field in an XFX form instruction.  This is like the SPR
      field, but it is optional.  */
@@ -489,52 +489,52 @@
   /* The TO field in a D or X form instruction.  */
 #define TO TBR + 1
 #define TO_MASK (0x1f << 21)
-  { 5, 21, NULL, NULL, 0 },
+  { 5, 21, 0, 0, 0 },
 
   /* The U field in an X form instruction.  */
 #define U TO + 1
-  { 4, 12, NULL, NULL, 0 },
+  { 4, 12, 0, 0, 0 },
 
   /* The UI field in a D form instruction.  */
 #define UI U + 1
-  { 16, 0, NULL, NULL, 0 },
+  { 16, 0, 0, 0, 0 },
 
   /* The VA field in a VA, VX or VXR form instruction.  */
 #define VA UI + 1
 #define VA_MASK	(0x1f << 16)
-  { 5, 16, NULL, NULL, PPC_OPERAND_VR },
+  { 5, 16, 0, 0, PPC_OPERAND_VR },
 
   /* The VB field in a VA, VX or VXR form instruction.  */
 #define VB VA + 1
 #define VB_MASK (0x1f << 11)
-  { 5, 11, NULL, NULL, PPC_OPERAND_VR },
+  { 5, 11, 0, 0, PPC_OPERAND_VR },
 
   /* The VC field in a VA form instruction.  */
 #define VC VB + 1
 #define VC_MASK (0x1f << 6)
-  { 5, 6, NULL, NULL, PPC_OPERAND_VR },
+  { 5, 6, 0, 0, PPC_OPERAND_VR },
 
   /* The VD or VS field in a VA, VX, VXR or X form instruction.  */
 #define VD VC + 1
 #define VS VD
 #define VD_MASK (0x1f << 21)
-  { 5, 21, NULL, NULL, PPC_OPERAND_VR },
+  { 5, 21, 0, 0, PPC_OPERAND_VR },
 
   /* The SIMM field in a VX form instruction.  */
 #define SIMM VD + 1
-  { 5, 16, NULL, NULL, PPC_OPERAND_SIGNED},
+  { 5, 16, 0, 0, PPC_OPERAND_SIGNED},
 
   /* The UIMM field in a VX form instruction.  */
 #define UIMM SIMM + 1
-  { 5, 16, NULL, NULL, 0 },
+  { 5, 16, 0, 0, 0 },
 
   /* The SHB field in a VA form instruction.  */
 #define SHB UIMM + 1
-  { 4, 6, NULL, NULL, 0 },
+  { 4, 6, 0, 0, 0 },
 
   /* The other UIMM field in a EVX form instruction.  */
 #define EVUIMM SHB + 1
-  { 5, 11, NULL, NULL, 0 },
+  { 5, 11, 0, 0, 0 },
 
   /* The other UIMM field in a half word EVX form instruction.  */
 #define EVUIMM_2 EVUIMM + 1
@@ -551,11 +551,11 @@
   /* The WS field.  */
 #define WS EVUIMM_8 + 1
 #define WS_MASK (0x7 << 11)
-  { 3, 11, NULL, NULL, 0 },
+  { 3, 11, 0, 0, 0 },
 
   /* The L field in an mtmsrd instruction */
 #define MTMSRD_L WS + 1
-  { 1, 16, NULL, NULL, PPC_OPERAND_OPTIONAL },
+  { 1, 16, 0, 0, PPC_OPERAND_OPTIONAL },
 
 };
 
@@ -1958,41 +1958,6 @@
 { "nmaclhwso.",	XO(4,494,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
 { "mfvscr",  VX(4, 1540), VX_MASK,	PPCVEC,		{ VD } },
 { "mtvscr",  VX(4, 1604), VX_MASK,	PPCVEC,		{ VB } },
-
-  /* Double-precision opcodes.  */
-  /* Some of these conflict with AltiVec, so move them before, since
-     PPCVEC includes the PPC_OPCODE_PPC set.  */
-{ "efscfd",   VX(4, 719), VX_MASK,	PPCEFS,		{ RS, RA } },
-{ "efdabs",   VX(4, 740), VX_MASK,	PPCEFS,		{ RS, RA } },
-{ "efdnabs",  VX(4, 741), VX_MASK,	PPCEFS,		{ RS, RA } },
-{ "efdneg",   VX(4, 742), VX_MASK,	PPCEFS,		{ RS, RA } },
-{ "efdadd",   VX(4, 736), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
-{ "efdsub",   VX(4, 737), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
-{ "efdmul",   VX(4, 744), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
-{ "efddiv",   VX(4, 745), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
-{ "efdcmpgt", VX(4, 748), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdcmplt", VX(4, 749), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdcmpeq", VX(4, 750), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdtstgt", VX(4, 764), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdtstlt", VX(4, 765), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdtsteq", VX(4, 766), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
-{ "efdcfsi",  VX(4, 753), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfsid", VX(4, 739), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfui",  VX(4, 752), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfuid", VX(4, 738), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfsf",  VX(4, 755), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfuf",  VX(4, 754), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctsi",  VX(4, 757), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctsidz",VX(4, 747), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctsiz", VX(4, 762), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctui",  VX(4, 756), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctuidz",VX(4, 746), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctuiz", VX(4, 760), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctsf",  VX(4, 759), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdctuf",  VX(4, 758), VX_MASK,	PPCEFS,		{ RS, RB } },
-{ "efdcfs",   VX(4, 751), VX_MASK,	PPCEFS,		{ RS, RB } },
-  /* End of double-precision opcodes.  */
-
 { "vaddcuw", VX(4,  384), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
 { "vaddfp",  VX(4,   10), VX_MASK, 	PPCVEC,		{ VD, VA, VB } },
 { "vaddsbs", VX(4,  768), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c
index 16fc4a9..8c31085 100644
--- a/opcodes/xtensa-dis.c
+++ b/opcodes/xtensa-dis.c
@@ -1,5 +1,5 @@
 /* xtensa-dis.c.  Disassembly functions for Xtensa.
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2003 Free Software Foundation, Inc.
    Contributed by Bob Wilson at Tensilica, Inc. (bwilson@tensilica.com)
 
    This file is part of GDB, GAS, and the GNU binutils.
@@ -25,33 +25,336 @@
 #include <string.h>
 #include "xtensa-isa.h"
 #include "ansidecl.h"
-#include "libiberty.h"
 #include "sysdep.h"
 #include "dis-asm.h"
 
 #include <setjmp.h>
 
-extern xtensa_isa xtensa_default_isa;
-
 #ifndef MAX
 #define MAX(a,b) (a > b ? a : b)
 #endif
 
+static char* state_names[256] =
+{
+  "lbeg", 		   	/* 0 */
+  "lend",  		   	/* 1 */
+  "lcount", 		   	/* 2 */
+  "sar",		   	/* 3 */
+  "br",			      	/* 4 */
+
+  "reserved_5",			/* 5 */
+  "reserved_6",			/* 6 */
+  "reserved_7",			/* 7 */
+
+  "av",				/* 8 */
+  "avh",		       	/* 9 */
+  "bv",				/* 10 */
+  "sav",			/* 11 */
+  "scompare1",		        /* 12 */
+
+  "reserved_13",	       	/* 13 */
+  "reserved_14",		/* 14 */
+  "reserved_15",		/* 15 */
+
+  "acclo",			/* 16 */
+  "acchi",			/* 17 */
+
+  "reserved_18",	        /* 18 */
+  "reserved_19",	       	/* 19 */
+  "reserved_20",		/* 20 */
+  "reserved_21",		/* 21 */
+  "reserved_22",	        /* 22 */
+  "reserved_23",	       	/* 23 */
+  "reserved_24",		/* 24 */
+  "reserved_25",		/* 25 */
+  "reserved_26",		/* 26 */
+  "reserved_27",		/* 27 */
+  "reserved_28",	        /* 28 */
+  "reserved_29",	       	/* 29 */
+  "reserved_30",		/* 30 */
+  "reserved_31",		/* 31 */
+
+  "mr0",			/* 32 */
+  "mr1", 			/* 33 */
+  "mr2",		      	/* 34 */
+  "mr3",			/* 35 */
+
+  "reserved_36",	        /* 36 */
+  "reserved_37",	       	/* 37 */
+  "reserved_38",		/* 38 */
+  "reserved_39",		/* 39 */
+  "reserved_40",	        /* 40 */
+  "reserved_41",	       	/* 41 */
+  "reserved_42",		/* 42 */
+  "reserved_43",		/* 43 */
+  "reserved_44",		/* 44 */
+  "reserved_45",		/* 45 */
+  "reserved_46",	        /* 46 */
+  "reserved_47",	       	/* 47 */
+  "reserved_48",		/* 48 */
+  "reserved_49",		/* 49 */
+  "reserved_50",	        /* 50 */
+  "reserved_51",	       	/* 51 */
+  "reserved_52",		/* 52 */
+  "reserved_53",		/* 53 */
+  "reserved_54",	        /* 54 */
+  "reserved_55",	       	/* 55 */
+  "reserved_56",		/* 56 */
+  "reserved_57",		/* 57 */
+  "reserved_58",		/* 58 */
+  "reserved_59",		/* 59 */
+  "reserved_60",	        /* 60 */
+  "reserved_61",	       	/* 61 */
+  "reserved_62",		/* 62 */
+  "reserved_63",		/* 63 */
+
+  "reserved_64",		/* 64 */
+  "reserved_65",		/* 65 */
+  "reserved_66",		/* 66 */
+  "reserved_67",		/* 67 */
+  "reserved_68",	        /* 68 */
+  "reserved_69",	       	/* 69 */
+  "reserved_70",		/* 70 */
+  "reserved_71",		/* 71 */
+
+  "wb",				/* 72 */
+  "ws",				/* 73 */
+
+  "reserved_74",		/* 74 */
+  "reserved_75",		/* 75 */
+  "reserved_76",	        /* 76 */
+  "reserved_77",	       	/* 77 */
+  "reserved_78",		/* 78 */
+  "reserved_79",		/* 79 */
+  "reserved_80",	        /* 80 */
+  "reserved_81",	       	/* 81 */
+  "reserved_82",		/* 82 */
+
+  "ptevaddr",			/* 83 */
+
+  "reserved_84",	        /* 84 */
+  "reserved_85",	       	/* 85 */
+  "reserved_86",		/* 86 */
+  "reserved_87",		/* 87 */
+  "reserved_88",		/* 88 */
+  "reserved_89",		/* 89 */
+
+  "rasid",		        /* 90 */
+  "itlbcfg",		       	/* 91 */
+  "dtlbcfg",			/* 92 */
+
+  "reserved_93",		/* 93 */
+  "reserved_94",		/* 94 */
+  "reserved_95",		/* 95 */
+
+  "ibreakenable",		/* 96 */
+
+  "reserved_97",		/* 97 */
+
+  "cacheattr",			/* 98 */
+
+  "reserved_99",		/* 99 */
+  "reserved_100",	       	/* 100 */
+  "reserved_101",	       	/* 101 */
+  "reserved_102",		/* 102 */
+  "reserved_103",		/* 103 */
+
+  "ddr",			/* 104 */
+
+  "reserved_105",		/* 105 */
+  "reserved_106",	        /* 106 */
+  "reserved_107",	       	/* 107 */
+  "reserved_108",		/* 108 */
+  "reserved_109",		/* 109 */
+  "reserved_110",	        /* 110 */
+  "reserved_111",	       	/* 111 */
+  "reserved_112",		/* 112 */
+  "reserved_113",		/* 113 */
+  "reserved_114",	        /* 114 */
+  "reserved_115",	       	/* 115 */
+  "reserved_116",		/* 116 */
+  "reserved_117",		/* 117 */
+  "reserved_118",		/* 118 */
+  "reserved_119",		/* 119 */
+  "reserved_120",	        /* 120 */
+  "reserved_121",	       	/* 121 */
+  "reserved_122",		/* 122 */
+  "reserved_123",		/* 123 */
+  "reserved_124",		/* 124 */
+  "reserved_125",		/* 125 */
+  "reserved_126",		/* 126 */
+  "reserved_127",		/* 127 */
+
+  "ibreaka0",			/* 128 */
+  "ibreaka1",			/* 129 */
+  "ibreaka2",			/* 130 */
+  "ibreaka3",			/* 131 */
+  "ibreaka4",			/* 132 */
+  "ibreaka5",			/* 133 */
+  "ibreaka6",			/* 134 */
+  "ibreaka7",			/* 135 */
+  "ibreaka8",			/* 136 */
+  "ibreaka9",			/* 137 */
+  "ibreaka10",       		/* 138 */
+  "ibreaka11",       		/* 139 */
+  "ibreaka12",       		/* 140 */
+  "ibreaka13",       		/* 141 */
+  "ibreaka14",       		/* 142 */
+  "ibreaka15",       		/* 143 */
+			   
+  "dbreaka0",			/* 144 */
+  "dbreaka1",			/* 145 */
+  "dbreaka2",			/* 146 */
+  "dbreaka3",			/* 147 */
+  "dbreaka4",			/* 148 */
+  "dbreaka5",			/* 149 */
+  "dbreaka6",			/* 150 */
+  "dbreaka7",			/* 151 */
+  "dbreaka8",			/* 152 */
+  "dbreaka9",			/* 153 */
+  "dbreaka10",       		/* 154 */
+  "dbreaka11",       		/* 155 */
+  "dbreaka12",       		/* 156 */
+  "dbreaka13",       		/* 157 */
+  "dbreaka14",       		/* 158 */
+  "dbreaka15",       		/* 159 */
+			   
+  "dbreakc0",			/* 160 */
+  "dbreakc1",			/* 161 */
+  "dbreakc2",			/* 162 */
+  "dbreakc3",			/* 163 */
+  "dbreakc4",			/* 164 */
+  "dbreakc5",			/* 165 */
+  "dbreakc6",			/* 166 */
+  "dbreakc7",			/* 167 */
+  "dbreakc8",			/* 168 */
+  "dbreakc9",			/* 169 */
+  "dbreakc10",       		/* 170 */
+  "dbreakc11",       		/* 171 */
+  "dbreakc12",       		/* 172 */
+  "dbreakc13",       		/* 173 */
+  "dbreakc14",       		/* 174 */
+  "dbreakc15",       		/* 175 */
+
+  "reserved_176",		/* 176 */
+
+  "epc1",			/* 177 */
+  "epc2",			/* 178 */
+  "epc3",			/* 179 */
+  "epc4",			/* 180 */
+  "epc5",			/* 181 */
+  "epc6",			/* 182 */
+  "epc7",			/* 183 */
+  "epc8",			/* 184 */
+  "epc9",			/* 185 */
+  "epc10",			/* 186 */
+  "epc11",			/* 187 */
+  "epc12",			/* 188 */
+  "epc13",			/* 189 */
+  "epc14",			/* 190 */
+  "epc15",			/* 191 */
+  "depc",			/* 192 */
+
+  "reserved_193",		/* 193 */
+
+  "eps2",	        	/* 194 */
+  "eps3",	        	/* 195 */
+  "eps4",	        	/* 196 */
+  "eps5",	        	/* 197 */
+  "eps6",	        	/* 198 */
+  "eps7",	        	/* 199 */
+  "eps8",	        	/* 200 */
+  "eps9",	        	/* 201 */
+  "eps10",			/* 202 */
+  "eps11",			/* 203 */
+  "eps12",			/* 204 */
+  "eps13",			/* 205 */
+  "eps14",			/* 206 */
+  "eps15",			/* 207 */
+
+  "reserved_208",		/* 208 */
+
+  "excsave1",			/* 209 */
+  "excsave2",			/* 210 */
+  "excsave3",			/* 211 */
+  "excsave4",			/* 212 */
+  "excsave5",			/* 213 */
+  "excsave6",			/* 214 */
+  "excsave7",			/* 215 */
+  "excsave8",			/* 216 */
+  "excsave9",			/* 217 */
+  "excsave10",       		/* 218 */
+  "excsave11",       		/* 219 */
+  "excsave12",       		/* 220 */
+  "excsave13",       		/* 221 */
+  "excsave14",       		/* 222 */
+  "excsave15",       		/* 223 */
+  "cpenable",			/* 224 */
+
+  "reserved_225",		/* 225 */
+
+  "interrupt",			/* 226 */
+  "interrupt2",			/* 227 */
+  "intenable",			/* 228 */
+
+  "reserved_229",		/* 229 */
+
+  "ps",				/* 230 */
+
+  "reserved_231",		/* 231 */
+
+  "exccause",			/* 232 */
+  "debugcause",			/* 233 */
+  "ccount",			/* 234 */
+  "prid",			/* 235 */
+  "icount",			/* 236 */
+  "icountlvl", 			/* 237 */
+  "excvaddr",			/* 238 */
+
+  "reserved_239",		/* 239 */
+
+  "ccompare0",			/* 240 */
+  "ccompare1",			/* 241 */
+  "ccompare2",			/* 242 */
+  "ccompare3",			/* 243 */
+
+  "misc0",			/* 244 */
+  "misc1",	 		/* 245 */
+  "misc2",			/* 246 */
+  "misc3",			/* 247 */
+
+  "reserved_248",		/* 248 */
+  "reserved_249",	        /* 249 */
+  "reserved_250",	       	/* 250 */
+  "reserved_251",		/* 251 */
+  "reserved_252",		/* 252 */
+  "reserved_253",	        /* 253 */
+  "reserved_254",	       	/* 254 */
+  "reserved_255",	       	/* 255 */
+};
+
+
 int show_raw_fields;
 
-struct dis_private
-{
+static int fetch_data
+  PARAMS ((struct disassemble_info *info, bfd_vma memaddr));
+static void print_xtensa_operand
+  PARAMS ((bfd_vma, struct disassemble_info *, xtensa_operand,
+	   unsigned operand_val, int print_sr_name));
+
+struct dis_private {
   bfd_byte *byte_buf;
   jmp_buf bailout;
 };
 
-
 static int
-fetch_data (struct disassemble_info *info, bfd_vma memaddr)
+fetch_data (info, memaddr)
+     struct disassemble_info *info;
+     bfd_vma memaddr;
 {
   int length, status = 0;
   struct dis_private *priv = (struct dis_private *) info->private_data;
-  int insn_size = xtensa_isa_maxlength (xtensa_default_isa);
+  int insn_size = xtensa_insn_maxlength (xtensa_default_isa);
 
   /* Read the maximum instruction size, padding with zeros if we go past
      the end of the text section.  This code will automatically adjust
@@ -72,13 +375,14 @@
 
 
 static void
-print_xtensa_operand (bfd_vma memaddr,
-		      struct disassemble_info *info,
-		      xtensa_opcode opc,
-		      int opnd,
-		      unsigned operand_val)
+print_xtensa_operand (memaddr, info, opnd, operand_val, print_sr_name)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+     xtensa_operand opnd;
+     unsigned operand_val;
+     int print_sr_name;
 {
-  xtensa_isa isa = xtensa_default_isa;
+  char *kind = xtensa_operand_kind (opnd);
   int signed_operand_val;
     
   if (show_raw_fields)
@@ -90,42 +394,29 @@
       return;
     }
 
-  (void) xtensa_operand_decode (isa, opc, opnd, &operand_val);
+  operand_val = xtensa_operand_decode (opnd, operand_val);
   signed_operand_val = (int) operand_val;
 
-  if (xtensa_operand_is_register (isa, opc, opnd) == 0)
+  if (xtensa_operand_isPCRelative (opnd))
     {
-      if (xtensa_operand_is_PCrelative (isa, opc, opnd) == 1)
-	{
-	  (void) xtensa_operand_undo_reloc (isa, opc, opnd,
-					    &operand_val, memaddr);
-	  info->target = operand_val;
-	  (*info->print_address_func) (info->target, info);
-	}
+      operand_val = xtensa_operand_undo_reloc (opnd, operand_val, memaddr);
+      info->target = operand_val;
+      (*info->print_address_func) (info->target, info);
+    }
+  else if (!strcmp (kind, "i"))
+    {
+      if (print_sr_name
+	  && signed_operand_val >= 0
+	  && signed_operand_val <= 255)
+	(*info->fprintf_func) (info->stream, "%s",
+			       state_names[signed_operand_val]);
+      else if ((signed_operand_val > -256) && (signed_operand_val < 256))
+	(*info->fprintf_func) (info->stream, "%d", signed_operand_val);
       else
-	{
-	  if ((signed_operand_val > -256) && (signed_operand_val < 256))
-	    (*info->fprintf_func) (info->stream, "%d", signed_operand_val);
-	  else
-	    (*info->fprintf_func) (info->stream, "0x%x", signed_operand_val);
-	}
+	(*info->fprintf_func) (info->stream, "0x%x",signed_operand_val);
     }
   else
-    {
-      int i = 1;
-      xtensa_regfile opnd_rf = xtensa_operand_regfile (isa, opc, opnd);
-      (*info->fprintf_func) (info->stream, "%s%u",
-			     xtensa_regfile_shortname (isa, opnd_rf),
-			     operand_val);
-      while (i < xtensa_operand_num_regs (isa, opc, opnd))
-	{
-	  operand_val++;
-	  (*info->fprintf_func) (info->stream, ":%s%u",
-				 xtensa_regfile_shortname (isa, opnd_rf),
-				 operand_val);
-	  i++;
-	} 
-    }
+    (*info->fprintf_func) (info->stream, "%s%u", kind, operand_val);
 }
 
 
@@ -133,24 +424,25 @@
    Returns length of the instruction in bytes.  */
 
 int
-print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
+print_insn_xtensa (memaddr, info)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
 {
   unsigned operand_val;
-  int bytes_fetched, size, maxsize, i, n, noperands, nslots;
+  int bytes_fetched, size, maxsize, i, noperands;
   xtensa_isa isa;
   xtensa_opcode opc;
-  xtensa_format fmt;
+  char *op_name;
+  int print_sr_name;
   struct dis_private priv;
   static bfd_byte *byte_buf = NULL;
   static xtensa_insnbuf insn_buffer = NULL;
-  static xtensa_insnbuf slot_buffer = NULL;
-  int first, first_slot, valid_insn;
 
   if (!xtensa_default_isa)
-    xtensa_default_isa = xtensa_isa_init (0, 0);
+    (void) xtensa_isa_init ();
 
   info->target = 0;
-  maxsize = xtensa_isa_maxlength (xtensa_default_isa);
+  maxsize = xtensa_insn_maxlength (xtensa_default_isa);
 
   /* Set bytes_per_line to control the amount of whitespace between the hex
      values and the opcode.  For Xtensa, we always print one "chunk" and we
@@ -166,23 +458,19 @@
 
   /* Allocate buffers the first time through.  */
   if (!insn_buffer)
-    {
-      insn_buffer = xtensa_insnbuf_alloc (xtensa_default_isa);
-      slot_buffer = xtensa_insnbuf_alloc (xtensa_default_isa);
-      byte_buf = (bfd_byte *) xmalloc (MAX (maxsize, 4));
-    }
+    insn_buffer = xtensa_insnbuf_alloc (xtensa_default_isa);
+  if (!byte_buf)
+    byte_buf = (bfd_byte *) malloc (MAX (maxsize, 4));
 
   priv.byte_buf = byte_buf;
 
-  info->private_data = (void *) &priv;
+  info->private_data = (PTR) &priv;
   if (setjmp (priv.bailout) != 0)
       /* Error return.  */
       return -1;
 
   /* Don't set "isa" before the setjmp to keep the compiler from griping.  */
   isa = xtensa_default_isa;
-  size = 0;
-  nslots = 0;
 
   /* Fetch the maximum size instruction.  */
   bytes_fetched = fetch_data (info, memaddr);
@@ -190,75 +478,44 @@
   /* Copy the bytes into the decode buffer.  */
   memset (insn_buffer, 0, (xtensa_insnbuf_size (isa) *
 			   sizeof (xtensa_insnbuf_word)));
-  xtensa_insnbuf_from_chars (isa, insn_buffer, priv.byte_buf, bytes_fetched);
+  xtensa_insnbuf_from_chars (isa, insn_buffer, priv.byte_buf);
 
-  fmt = xtensa_format_decode (isa, insn_buffer);
-  if (fmt == XTENSA_UNDEFINED
-      || ((size = xtensa_format_length (isa, fmt)) > bytes_fetched))
-    valid_insn = 0;
-  else
-    {
-      /* Make sure all the opcodes are valid.  */
-      valid_insn = 1;
-      nslots = xtensa_format_num_slots (isa, fmt);
-      for (n = 0; n < nslots; n++)
-	{
-	  xtensa_format_get_slot (isa, fmt, n, insn_buffer, slot_buffer);
-	  if (xtensa_opcode_decode (isa, fmt, n, slot_buffer)
-	      == XTENSA_UNDEFINED)
-	    {
-	      valid_insn = 0;
-	      break;
-	    }
-	}
-    }
-
-  if (!valid_insn)
+  opc = xtensa_decode_insn (isa, insn_buffer);
+  if (opc == XTENSA_UNDEFINED
+      || ((size = xtensa_insn_length (isa, opc)) > bytes_fetched))
     {
       (*info->fprintf_func) (info->stream, ".byte %#02x", priv.byte_buf[0]);
       return 1;
     }
 
-  if (nslots > 1)
-    (*info->fprintf_func) (info->stream, "{ ");
+  op_name = (char *) xtensa_opcode_name (isa, opc);
+  (*info->fprintf_func) (info->stream, "%s", op_name);
 
-  first_slot = 1;
-  for (n = 0; n < nslots; n++)
+  print_sr_name = (!strcasecmp (op_name, "wsr")
+		   || !strcasecmp (op_name, "xsr")
+		   || !strcasecmp (op_name, "rsr"));
+
+  /* Print the operands (if any).  */
+  noperands = xtensa_num_operands (isa, opc);
+  if (noperands > 0)
     {
-      if (first_slot)
-	first_slot = 0;
-      else
-	(*info->fprintf_func) (info->stream, "; ");
+      int first = 1;
 
-      xtensa_format_get_slot (isa, fmt, n, insn_buffer, slot_buffer);
-      opc = xtensa_opcode_decode (isa, fmt, n, slot_buffer);
-      (*info->fprintf_func) (info->stream, "%s",
-			     xtensa_opcode_name (isa, opc));
-
-      /* Print the operands (if any).  */
-      noperands = xtensa_opcode_num_operands (isa, opc);
-      first = 1;
+      (*info->fprintf_func) (info->stream, "\t");
       for (i = 0; i < noperands; i++)
 	{
-	  if (xtensa_operand_is_visible (isa, opc, i) == 0)
-	    continue;
+	  xtensa_operand opnd = xtensa_get_operand (isa, opc, i);
+
 	  if (first)
-	    {
-	      (*info->fprintf_func) (info->stream, "\t");
-	      first = 0;
-	    }
+	    first = 0;
 	  else
 	    (*info->fprintf_func) (info->stream, ", ");
-	  (void) xtensa_operand_get_field (isa, opc, i, fmt, n,
-					   slot_buffer, &operand_val);
-
-	  print_xtensa_operand (memaddr, info, opc, i, operand_val);
-	}
+	  operand_val = xtensa_operand_get_field (opnd, insn_buffer);
+	  print_xtensa_operand (memaddr, info, opnd, operand_val,
+				print_sr_name);
+        }
     }
 
-  if (nslots > 1)
-    (*info->fprintf_func) (info->stream, " }");
-
   info->bytes_per_chunk = size;
   info->display_endian = info->endian;
 
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index ba104bd..0099da0 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,7 +1,3 @@
-2004-10-07  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
-
-	* cgen-defs.h (ENDSWITCH): Changed to compile with gcc-3.4.2.
-
 2004-07-26  Andrew Cagney  <cagney@gnu.org>
 
 	Problem from Olaf Hering <olh@suse.de>.
diff --git a/sim/common/cgen-defs.h b/sim/common/cgen-defs.h
index cf9c028..fbdfb9a 100644
--- a/sim/common/cgen-defs.h
+++ b/sim/common/cgen-defs.h
@@ -130,7 +130,7 @@
 #define CASE(N, X) case_##N##_##X
 #define BREAK(N) goto end_switch_##N
 #define DEFAULT(N) default_##N
-#define ENDSWITCH(N) end_switch_##N:;
+#define ENDSWITCH(N) end_switch_##N:
 #else
 #define SWITCH(N, X) switch (X)
 #define CASE(N, X) case X /* FIXME: old sem-switch had (@arch@_,X) here */
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index ea4acfb..7cf7314 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,8 +1,3 @@
-2004-09-24  Monika Chaddha  <monika@acmet.com>
-	
-	Committed by Andrew Cagney.
-	* m16.igen (CMP, CMPI): Fix assembler.
-
 2004-08-18  Chris Demetriou  <cgd@broadcom.com>
 
 	* configure.in (mipsisa64sb1*-*-*): Add mips3d to sim_igen_machine.
diff --git a/sim/mips/m16.igen b/sim/mips/m16.igen
index f87a863..833d7ca 100644
--- a/sim/mips/m16.igen
+++ b/sim/mips/m16.igen
@@ -614,7 +614,7 @@
 
 
 11101,3.RX,3.RY,01010:RR:16::CMP
-"cmp r<TRX>, r<TRY>"
+"sltiu r<TRX>, r<TRY>"
 *mips16:
 *vr4100:
 {
@@ -623,7 +623,7 @@
 
 
 01110,3.RX,8.IMMED:RI:16::CMPI
-"cmpi r<TRX>, <IMMED>"
+"sltiu r<TRX>, <IMMED>"
 *mips16:
 *vr4100:
 {
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 066aa75..4d55679 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,11 +1,3 @@
-2004-09-24  Ian Lance Taylor <ian@wasabisystems.com>
-
-	Committed by Andrew Cagney.
-	* configure.in: Check for sys/mount.h, sys/vfs.h, sys/statfs.h.
-	Check for struct statfs.
-	* emul_netbsd.c: If not HAVE_STRUCT_STATFS, #undef HAVE_FSTATFS.
-	* configure, config.in: Regenerate.
-
 2004-08-05  Nathanael Nerode  <neroden@gcc.gnu.org>
 
 	* Makefile.in (GDB_INCLUDES): Remove bogus reference to mmalloc.
diff --git a/sim/ppc/config.in b/sim/ppc/config.in
index 53f67e6..c53a833 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -337,9 +337,6 @@
 /* Define if you have the <sys/stat.h> header file.  */
 #undef HAVE_SYS_STAT_H
 
-/* Define if you have the <sys/statfs.h> header file.  */
-#undef HAVE_SYS_STATFS_H
-
 /* Define if you have the <sys/termio.h> header file.  */
 #undef HAVE_SYS_TERMIO_H
 
@@ -355,9 +352,6 @@
 /* Define if you have the <sys/types.h> header file.  */
 #undef HAVE_SYS_TYPES_H
 
-/* Define if you have the <sys/vfs.h> header file.  */
-#undef HAVE_SYS_VFS_H
-
 /* Define if you have the <time.h> header file.  */
 #undef HAVE_TIME_H
 
@@ -366,7 +360,3 @@
 
 /* Define if you have the <values.h> header file.  */
 #undef HAVE_VALUES_H
-
-/* Define if struct statfs is defined in <sys/mount.h> */
-#undef HAVE_STRUCT_STATFS
-
diff --git a/sim/ppc/configure b/sim/ppc/configure
index c687e66..51f50c5 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -4294,7 +4294,7 @@
 done
 
 
-for ac_hdr in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h
+for ac_hdr in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -4609,54 +4609,9 @@
   ac_cv_termio_cline=no
 fi
 
-echo $ac_n "checking for struct statfs""... $ac_c" 1>&6
-echo "configure:4614: checking for struct statfs" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_statfs'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4619 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#ifdef HAVE_SYS_STATFS_H
-#include <sys/statfs.h>
-#endif
-int main() {
-static struct statfs s;
-; return 0; }
-EOF
-if { (eval echo configure:4638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_struct_statfs=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_struct_statfs=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_statfs" 1>&6
-if test $ac_cv_struct_statfs = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_STRUCT_STATFS 1
-EOF
-
-fi
-
 sim_devzero=""
 echo $ac_n "checking for /dev/zero""... $ac_c" 1>&6
-echo "configure:4660: checking for /dev/zero" >&5
+echo "configure:4615: checking for /dev/zero" >&5
 if eval "test \"`echo '$''{'ac_cv_devzero'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4664,7 +4619,7 @@
   ac_cv_devzero=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4668 "configure"
+#line 4623 "configure"
 #include "confdefs.h"
 #include <fcntl.h>
 main () {
@@ -4683,7 +4638,7 @@
   return 0;
 }
 EOF
-if { (eval echo configure:4687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_devzero=yes
 else
@@ -4705,7 +4660,7 @@
 fi
 
 echo $ac_n "checking for common simulator directory""... $ac_c" 1>&6
-echo "configure:4709: checking for common simulator directory" >&5
+echo "configure:4664: checking for common simulator directory" >&5
 if test -f "${srcdir}/../common/callback.c"; then
   echo "$ac_t""yes" 1>&6
   sim_callback="callback.o targ-map.o"
@@ -4717,7 +4672,7 @@
 fi
 
 echo $ac_n "checking for common simulator directory fpu implementation""... $ac_c" 1>&6
-echo "configure:4721: checking for common simulator directory fpu implementation" >&5
+echo "configure:4676: checking for common simulator directory fpu implementation" >&5
 if test -f "${srcdir}/../common/sim-fpu.c"; then
   echo "$ac_t""yes" 1>&6
   sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
@@ -4729,12 +4684,12 @@
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:4733: checking for Cygwin environment" >&5
+echo "configure:4688: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4738 "configure"
+#line 4693 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4745,7 +4700,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:4749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -4762,19 +4717,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:4766: checking for mingw32 environment" >&5
+echo "configure:4721: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4771 "configure"
+#line 4726 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:4778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -4793,7 +4748,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4797: checking for executable suffix" >&5
+echo "configure:4752: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4803,7 +4758,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:4807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:4762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -4832,7 +4787,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4836: checking for $ac_word" >&5
+echo "configure:4791: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in
index 7884a411..1f0693c 100644
--- a/sim/ppc/configure.in
+++ b/sim/ppc/configure.in
@@ -585,7 +585,7 @@
 
 AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
 
-AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h)
+AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h)
 AC_HEADER_DIRENT
 
 dnl Figure out what type of termio/termios support there is
@@ -658,30 +658,6 @@
   ac_cv_termio_cline=no
 fi
 
-dnl Check for struct statfs
-AC_MSG_CHECKING(for struct statfs)
-AC_CACHE_VAL(ac_cv_struct_statfs,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#ifdef HAVE_SYS_STATFS_H
-#include <sys/statfs.h>
-#endif],
-[static struct statfs s;],
-ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
-AC_MSG_RESULT($ac_cv_struct_statfs)
-if test $ac_cv_struct_statfs = yes; then
-  AC_DEFINE(HAVE_STRUCT_STATFS, 1,
-	    [Define if struct statfs is defined in <sys/mount.h>])
-fi
-
 dnl Figure out if /dev/zero exists or not
 sim_devzero=""
 AC_MSG_CHECKING(for /dev/zero)
diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index 18ca73b..3ea03f6 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -94,14 +94,6 @@
 #include <sys/sysctl.h>
 #include <sys/mount.h>
 extern int getdirentries(int fd, char *buf, int nbytes, long *basep);
-
-/* NetBSD post 2.0 has the statfs system call (if COMPAT_20), but does
-   not have struct statfs.  In this case don't implement fstatfs.
-   FIXME: Should implement fstatvfs.  */
-#ifndef HAVE_STRUCT_STATFS
-#undef HAVE_FSTATFS
-#endif
-
 #else
 
 /* If this is not netbsd, don't allow fstatfs or getdirentries at this time */